Azure.Identity.Broker 1.1.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Azure.Identity.Broker --version 1.1.0                
NuGet\Install-Package Azure.Identity.Broker -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Azure.Identity.Broker" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Azure.Identity.Broker --version 1.1.0                
#r "nuget: Azure.Identity.Broker, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Azure.Identity.Broker as a Cake Addin
#addin nuget:?package=Azure.Identity.Broker&version=1.1.0

// Install Azure.Identity.Broker as a Cake Tool
#tool nuget:?package=Azure.Identity.Broker&version=1.1.0                

Azure Identity Brokered Authentication client library for .NET

The library extends the Azure.Identity library to provide authentication broker support. It includes the necessary dependencies and provides the InteractiveBrowserCredentialBrokerOptions class. This options class can be used to create an InteractiveBrowserCredential capable of using the system authentication broker in lieu of an embedded web view or the system browser.

Source code | Package (NuGet) | API reference documentation | Microsoft Entra ID documentation

Getting started

Install the package

Install the Azure Identity client library for .NET with NuGet:

dotnet add package Azure.Identity.Broker


The Azure.Identity library is a dependency of Azure.Identity.Broker.

Authenticate the client

Key concepts

This package enables authentication broker support via InteractiveBrowserCredentialBrokerOptions, in combination with InteractiveBrowserCredential in the Azure.Identity package.

Parent window handles

When authenticating interactively via InteractiveBrowserCredential constructed with the InteractiveBrowserCredentialBrokerOptions, a parent window handle is required to ensure that the authentication dialog is shown correctly over the requesting window. In the context of graphical user interfaces on devices, a window handle is a unique identifier that the operating system assigns to each window. For the Windows operating system, this handle is an integer value that serves as a reference to a specific window.

Microsoft account (MSA) passthrough

Microsoft accounts (MSA) are personal accounts created by users to access Microsoft services. MSA passthrough is a legacy configuration which enables users to get tokens to resources which normally don't accept MSA logins. This feature is only available to first-party applications. Users authenticating with an application that is configured to use MSA passthrough can set the InteractiveBrowserCredentialBrokerOptions.IsLegacyMsaPassthroughEnabled property to true to allow these personal accounts to be listed by WAM.

Redirect URIs

Microsoft Entra applications rely on redirect URIs to determine where to send the authentication response after a user has logged in. To enable brokered authentication through WAM, a redirect URI matching the following pattern should be registered to the application:



Configure the InteractiveBrowserCredential to use the system authentication broker

This example demonstrates configuring the InteractiveBrowserCredential with the specialized options type InteractiveBrowserCredentialBrokerOptions to enable brokered authentication.

IntPtr parentWindowHandle = GetForegroundWindow();

// Create an interactive browser credential which will use the system authentication broker
var credential = new InteractiveBrowserCredential(
    new InteractiveBrowserCredentialBrokerOptions(parentWindowHandle));

// Use the credential to authenticate a secret client
var client = new SecretClient(new Uri(""), credential);

To bypass the account selection dialog and use the default broker account, set the InteractiveBrowserCredentialBrokerOptions.UseDefaultBrokerAccount property:

var credential = new InteractiveBrowserCredential(
    new InteractiveBrowserCredentialBrokerOptions(parentWindowHandle)
        UseDefaultBrokerAccount = true,


See the troubleshooting guide for details on how to diagnose various failure scenarios.

Error handling

Errors arising from authentication can be raised on any service client method which makes a request to the service. This is because the first time the token is requested from the credential is on the first call to the service, and any subsequent calls might need to refresh the token. In order to distinguish these failures from failures in the service client Azure Identity classes raise the AuthenticationFailedException with details to the source of the error in the exception message as well as possibly the error message. Depending on the application these errors may or may not be recoverable.

using Azure.Identity;
using Azure.Security.KeyVault.Secrets;

// Create a secret client using the DefaultAzureCredential
var client = new SecretClient(new Uri(""), new DefaultAzureCredential());

    KeyVaultSecret secret = await client.GetSecretAsync("secret1");
catch (AuthenticationFailedException e)
    Console.WriteLine($"Authentication Failed. {e.Message}");

For more details on dealing with errors arising from failed requests to Microsoft Entra ID, or managed identity endpoints please refer to the Microsoft Entra ID documentation on authorization error codes.


The Azure Identity library provides the same logging capabilities as the rest of the Azure SDK.

The simplest way to see the logs to help debug authentication issues is to enable the console logging.

// Setup a listener to monitor logged events.
using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsoleLogger();

All credentials can be configured with diagnostic options, in the same way as other clients in the SDK.

DefaultAzureCredentialOptions options = new DefaultAzureCredentialOptions()
    Diagnostics =
        LoggedHeaderNames = { "x-ms-request-id" },
        LoggedQueryParameters = { "api-version" },
        IsLoggingContentEnabled = true

CAUTION: Requests and responses in the Azure Identity library contain sensitive information. Precaution must be taken to protect logs when customizing the output to avoid compromising account security.

Thread safety

We guarantee that all credential instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing credential instances is always safe, even across threads.

Additional concepts

Client options | Accessing the response | Diagnostics | Mocking | Client lifetime

Next steps

Client libraries supporting authentication with Azure Identity

Many of the client libraries listed here support authenticating with TokenCredential and the Azure Identity library. There you will also find links where you can learn more about their use, including additional documentation and samples.

Known issues

This library does not currently support scenarios relating to the AAD B2C service.

Currently open issues for the Azure.Identity library can be found here.


This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.

Product 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 was computed.  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 was computed.  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. 
.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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Azure.Identity.Broker:

Repository Stars
Microsoft Azure PowerShell
Powershell SDK for Microsoft Graph
Version Downloads Last updated
1.2.0-beta.1 305 4/24/2024
1.1.0 9,025 4/9/2024
1.1.0-beta.1 165 2/6/2024
1.0.0 8,742 11/7/2023
1.0.0-beta.5 11,135 10/19/2023