BrokerCredentialResolver Class

Definition

A CredentialResolver that produces broker-backed TokenCredential instances from an IConfigurationSection. It claims sections whose CredentialSource resolves to BrokerCredential or VisualStudioCodeCredential β€” the two credential sources that require the Azure.Identity.Broker package to function. All other sources are deferred (return false) so the next resolver in the chain (typically AzureCredentialResolver) can claim them.

public sealed class BrokerCredentialResolver : System.ClientModel.Primitives.CredentialResolver
type BrokerCredentialResolver = class
    inherit CredentialResolver
Public NotInheritable Class BrokerCredentialResolver
Inherits CredentialResolver
Inheritance
BrokerCredentialResolver

Remarks

Register this resolver explicitly via AddBrokerCredentialResolver(IServiceCollection) (or its host-builder overload) for the DI flow, or pass an instance to GetAzureClientSettings<T>(IConfiguration, String, CredentialResolver[]) (and friends) for the standalone configuration flow. The class has a public parameterless constructor so it can be used with AddCredentialResolver<BrokerCredentialResolver>().

Constructors

Name Description
BrokerCredentialResolver()

Initializes a new instance of BrokerCredentialResolver.

Properties

Name Description
Default

A shared singleton instance suitable for both standalone and DI usage. SCM's credential cache keys cached providers by resolver reference, so passing this instance into a standalone GetCredential call (or any resolver chain you build by hand) lets that path share cached credentials with code paths that resolved through DI via AddBrokerCredentialResolver(IServiceCollection). Stateless; safe to share across threads.

Methods

Name Description
TryResolve(IConfigurationSection, AuthenticationTokenProvider)

Attempts to construct an AuthenticationTokenProvider for the supplied credential configuration section.

TryResolve(IConfigurationSection, Func<IConfigurationSection,AuthenticationTokenProvider>, AuthenticationTokenProvider)

Attempts to construct an AuthenticationTokenProvider for the supplied credential configuration section, with access to a callback that recursively resolves child sections through the same active resolver chain.

(Inherited from CredentialResolver)

Applies to