Azure.Identity.BrokeredAuthentication 1.0.0-beta.4

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
Suggested Alternatives

Azure.Identity.Broker

Additional Details

Please note, this package is obsolete as of 10/19/2023 and is no longer maintained or monitored. Microsoft encourages you to upgrade to the replacement package, Azure.Identity.Broker, to continue receiving updates. Refer to our deprecation policy (https://aka.ms/azsdk/support-policies) for more details.

This is a prerelease version of Azure.Identity.BrokeredAuthentication.
dotnet add package Azure.Identity.BrokeredAuthentication --version 1.0.0-beta.4
NuGet\Install-Package Azure.Identity.BrokeredAuthentication -Version 1.0.0-beta.4
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.BrokeredAuthentication" Version="1.0.0-beta.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Azure.Identity.BrokeredAuthentication --version 1.0.0-beta.4
#r "nuget: Azure.Identity.BrokeredAuthentication, 1.0.0-beta.4"
#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.BrokeredAuthentication as a Cake Addin
#addin nuget:?package=Azure.Identity.BrokeredAuthentication&version=1.0.0-beta.4&prerelease

// Install Azure.Identity.BrokeredAuthentication as a Cake Tool
#tool nuget:?package=Azure.Identity.BrokeredAuthentication&version=1.0.0-beta.4&prerelease

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 the system browser when available.

Source code | Package (nuget) | API reference documentation | Azure Active Directory documentation

Getting started

Install the package

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

dotnet add package Azure.Identity.BrokeredAuthentication --prerelease

Prerequisites

  • The Azure.Identity library is a dependency of Azure.Identity.BrokeredAuthentication.

Authenticate the client

Key concepts

Examples

Configuring 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("https://myvault.vault.azure.net/"), credential);

Troubleshooting

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("https://myvault.vault.azure.net/"), new DefaultAzureCredential());

try
{
    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 Azure Active Directory, or managed identity endpoints please refer to the Azure Active Directory documentation on authorization error codes.

Logging

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.

Contributing

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 https://cla.microsoft.com.

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 opencode@microsoft.com 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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta.4 1,250 7/17/2023
1.0.0-beta.3 53,194 8/10/2022
1.0.0-beta.2 654 4/6/2022
1.0.0-beta.1 453 2/23/2022