Language

AzureCredentialResolver Class

Definition

A CredentialResolver that produces Azure TokenCredential instances from an IConfigurationSection, dispatching on the section's CredentialSource value (e.g. AzureCliCredential, ManagedIdentityCredential, EnvironmentCredential, WorkloadIdentityCredential, ChainedTokenCredential).

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

Remarks

Register this resolver explicitly via AddAzureCredentialResolver(IServiceCollection) (or its host-builder overload), or rely on GetAzureCredentialSettings(IConfiguration, String) and friends, which transparently append a built-in instance to the resolver chain. The class has a public parameterless constructor so it can be used with AddCredentialResolver().

Constructors

Name Description
AzureCredentialResolver()

Initializes a new instance of AzureCredentialResolver.

Properties

Name Description
Default

A shared singleton suitable for standalone callers that want to participate in the process-wide resolved-credential cache without allocating a new resolver instance per call.

Methods

Name Description
TryResolve(IConfigurationSection, AuthenticationTokenProvider)

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

TryResolve(IConfigurationSection, Func, 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)
TryResolveCore(IConfigurationSection, Func, AuthenticationTokenProvider)

Override to implement chain-aware resolution. The default implementation ignores resolveChild and forwards to TryResolve(IConfigurationSection, AuthenticationTokenProvider).

(Inherited from CredentialResolver)

Applies to