Microsoft.Identity.Web.Azure
3.13.2
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Identity.Web.Azure --version 3.13.2
NuGet\Install-Package Microsoft.Identity.Web.Azure -Version 3.13.2
<PackageReference Include="Microsoft.Identity.Web.Azure" Version="3.13.2" />
<PackageVersion Include="Microsoft.Identity.Web.Azure" Version="3.13.2" />
<PackageReference Include="Microsoft.Identity.Web.Azure" />
paket add Microsoft.Identity.Web.Azure --version 3.13.2
#r "nuget: Microsoft.Identity.Web.Azure, 3.13.2"
#:package Microsoft.Identity.Web.Azure@3.13.2
#addin nuget:?package=Microsoft.Identity.Web.Azure&version=3.13.2
#tool nuget:?package=Microsoft.Identity.Web.Azure&version=3.13.2
Microsoft.Identity.Web.Azure
This package enables ASP.NET Core web apps and web APIs to use the Azure SDKs with the Microsoft identity platform (formerly Azure AD v2.0).
Features
- MicrosoftIdentityTokenCredential - Provides seamless integration between Microsoft.Identity.Web and Azure SDK's TokenCredential, enabling your application to use Azure services with Microsoft Entra ID (formerly Azure Active Directory) authentication.
- Supports both user delegated and application permission scenarios
- Works with the standard Azure SDK authentication flow
Installation
dotnet add package Microsoft.Identity.Web.Azure
## Usage
### Basic setup
1. Register the Azure Token Credential in your service collection:
```cshap
// In your Startup.cs or Program.cs
using Azure.Storage.Blobs;
using Microsoft.Extensions.Azure;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Identity.Web;
public void ConfigureServices(IServiceCollection services)
{
// Register Microsoft Identity Web
services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
.EnableTokenAcquisitionToCallDownstreamApi()
.AddInMemoryTokenCaches();
// Add the Azure Token Credential
services.AddMicrosoftIdentityAzureTokenCredential();
// Register Azure services
services.AddAzureClients(builder =>
{
// Use the Microsoft Identity credential for all Azure clients
builder.UseCredential(sp => sp.GetRequiredService<MicrosoftIdentityTokenCredential>());
// Configure Azure Blob Storage client
builder.AddBlobServiceClient(new Uri("https://your-storage-account.blob.core.windows.net"));
// Add other Azure clients as needed
});
}
Using with Azure SDK clients
Once registered, the BlobServiceClient can be injected directly into your controllers or services: // Direct injection into a controller or Razor Page
[Authorize]
public class BlobController : Controller
{
private readonly BlobServiceClient _blobServiceClient;
private readonly MicrosoftIdentityTokenCredential _tokenCredential;
public BlobController(
BlobServiceClient blobServiceClient,
MicrosoftIdentityTokenCredential tokenCredential) // Optional: inject if you need to modify token behavior
{
_blobServiceClient = blobServiceClient;
_tokenCredential = tokenCredential;
}
[HttpGet]
public async Task<IActionResult> DownloadBlob(string containerName, string blobName)
{
try
{
// If you want to have get a blob on behalf of the app itself.
_tokenCredential.Options.RequestAppToken = true;
var containerClient = _blobServiceClient.GetBlobContainerClient(containerName);
var blobClient = containerClient.GetBlobClient(blobName);
// Check if blob exists
if (!await blobClient.ExistsAsync())
{
return NotFound($"Blob '{blobName}' not found in container '{containerName}'");
}
// Download the blob content
var response = await blobClient.DownloadContentAsync();
string content = response.Value.Content.ToString();
return Content(content);
}
catch (Exception ex)
{
return StatusCode(500, $"Error accessing blob: {ex.Message}");
}
}
For Razor Pages, you can similarly inject the client directly:
public class BlobModel : PageModel
{
private readonly BlobServiceClient _blobServiceClient;
public BlobModel(BlobServiceClient blobServiceClient)
{
_blobServiceClient = blobServiceClient;
}
public async Task<IActionResult> OnGetAsync(string containerName, string blobName)
{
// Use the blob service client directly in your page handler
var containerClient = _blobServiceClient.GetBlobContainerClient(containerName);
// ...rest of the implementation
}
}
Advanced scenarios
Using with specific authentication schemes
If your application has multiple authentication schemes, you can specify which one to use: // Configure the token credential to use a specific authentication scheme tokenCredential.Options.AcquireTokenOptions.AuthenticationOptionsName = OpenIdConnectDefaults.AuthenticationScheme;
Custom configuration
You can customize the token acquisition behavior:
// Configure additional options
tokenCredential.Options.AcquireTokenOptions.CorrelationId = Guid.NewGuid();
tokenCredential.Options.AcquireTokenOptions.Tenant = "GUID";
## Working with older versions
This package includes two token credentials classes:
- `MicrosoftIdentityTokenCredential` (recommended)
- `TokenAcquirerTokenCredential` (deprecated)
The `TokenAcquirerTokenCredential` is marked as obsolete and is included for backward compatibility. New applications should use `MicrosoftIdentityTokenCredential` instead.
## Integration with Azure SDKs
This package enables integration with [Azure SDKs for .NET](https://learn.microsoft.com/dotnet/azure/sdk/azure-sdk-for-dotnet), including but not limited to:
- Azure Storage (Blobs, Queues, Tables, Files)
- Azure Key Vault (although you might rather want to use the DefaultCrentialLoader for credentials)
- Azure Service Bus
- Azure Cosmos DB
- Azure Event Hubs
- Azure Monitor
See [Azure SDK for .NET packages](https://learn.microsoft.com/dotnet/azure/sdk/packages#libraries-using-azurecore)
for the list of packages.
## Related packages
- [Microsoft.Identity.Web](https://www.nuget.org/packages/Microsoft.Identity.Web/)
- [Microsoft.Identity.Web.UI](https://www.nuget.org/packages/Microsoft.Identity.Web.UI/)
- [Microsoft.Identity.Web.MicrosoftGraph](https://www.nuget.org/packages/Microsoft.Identity.Web.MicrosoftGraph/)
## Learn more
- [Microsoft Identity Web documentation](https://aka.ms/ms-identity-web)
- [Azure SDK documentation](https://docs.microsoft.com/azure/developer/azure-sdk/)
- [Microsoft identity platform documentation](https://docs.microsoft.com/azure/active-directory/develop/)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Identity.Web.TokenAcquisition (>= 3.13.2)
-
.NETFramework 4.7.2
- Microsoft.Identity.Web.TokenAcquisition (>= 3.13.2)
-
.NETStandard 2.0
- Microsoft.Identity.Web.TokenAcquisition (>= 3.13.2)
-
net6.0
- Microsoft.Identity.Web.TokenAcquisition (>= 3.13.2)
-
net7.0
- Microsoft.Identity.Web.TokenAcquisition (>= 3.13.2)
-
net8.0
- Microsoft.Identity.Web.TokenAcquisition (>= 3.13.2)
-
net9.0
- Microsoft.Identity.Web.TokenAcquisition (>= 3.13.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.7.0 | 308 | 4/2/2026 |
| 4.6.0 | 946 | 3/20/2026 |
| 4.5.0 | 1,245 | 3/5/2026 |
| 4.4.0 | 15,134 | 2/27/2026 |
| 4.4.0-preview.1 | 4,148 | 2/13/2026 |
| 4.3.0 | 23,910 | 1/7/2026 |
| 4.2.0 | 16,452 | 12/17/2025 |
| 4.1.1 | 5,504 | 11/24/2025 |
| 4.1.0 | 3,445 | 11/19/2025 |
| 4.0.1 | 42,578 | 10/20/2025 |
| 4.0.0 | 5,468 | 10/13/2025 |
| 3.14.1 | 20,371 | 9/10/2025 |
| 3.14.0 | 8,194 | 8/28/2025 |
| 3.13.2 | 5,926 | 8/19/2025 |
| 3.13.1 | 5,247 | 8/15/2025 |
| 3.13.0 | 9,468 | 8/8/2025 |
| 3.12.0 | 4,758 | 7/30/2025 |
| 3.11.0 | 5,139 | 7/21/2025 |
| 3.10.0 | 5,121 | 7/5/2025 |
| 3.9.4 | 4,929 | 6/17/2025 |
The release notes are available at https://github.com/AzureAD/microsoft-identity-web/releases and the roadmap at https://github.com/AzureAD/microsoft-identity-web/wiki#roadmap