Editar

Compartir vía


Microsoft Identity Web authentication library

Microsoft Identity Web is a set of ASP.NET Core libraries that simplifies adding authentication and authorization support to web apps, web APIs, and daemon apps integrating with the Microsoft identity platform. It provides a single-surface API convenience layer that ties together ASP.NET or ASP.NET Core, their authentication middleware, and the Microsoft Authentication Library (MSAL) for .NET that acquires tokens. It can be installed via NuGet or by using a Visual Studio project template to create a new app project

Supported application scenarios

When building ASP.NET Core web apps or web APIs that use Microsoft Entra ID or Azure AD B2C for identity and access management (IAM), Microsoft Identity Web is recommended for these scenarios:

Supported platforms

Microsoft identity web is available for .NET 6+, .NET 4.6.2, .NET 4.7.2, and .NET Standard 2.0.

Install from NuGet

Microsoft Identity Web is available on NuGet as a set of packages that provide modular functionality based on application requirements. Use the .NET CLI's dotnet add command or Visual Studio's NuGet Package Manager to install the appropriate packages:

The following NuGet packages, which are referenced by the packages above, can also be used directly with MSAL.NET:

Install by using a Visual Studio project template

Several project templates that use Microsoft.Identity.Web are included in .NET SDK versions 6.0 and above.

.NET 5.0+ - Project templates included

The Microsoft Identity Web project templates are included in .NET SDK versions 5.0 and above.

In the following example, .NET CLI command creates a Blazor Server project that includes Microsoft Identity Web.

dotnet new webapp --auth SingleOrg --calls-graph --client-id "00001111-aaaa-2222-bbbb-3333cccc4444" --tenant-id "aaaabbbb-0000-cccc-1111-dddd2222eeee" --output my-blazor-app

Getting started with MSAL.NET

  1. Learn about Scenarios.
  2. You'll need to register your app with Microsoft Entra ID.

Samples

See our comprehensive sample list.