DefaultAzureCredential Class

Definition

Provides a default TokenCredential authentication flow for applications that will be deployed to Azure. The following credential types if enabled will be tried, in order:

Consult the documentation of these credential types for more information on how they attempt authentication.
public class DefaultAzureCredential : Azure.Core.TokenCredential
type DefaultAzureCredential = class
    inherit TokenCredential
Public Class DefaultAzureCredential
Inherits TokenCredential
Inheritance
DefaultAzureCredential

Remarks

Note that credentials requiring user interaction, such as the InteractiveBrowserCredential, are not included by default. Callers must explicitly enable this when constructing the DefaultAzureCredential either by setting the includeInteractiveCredentials parameter to true, or the setting the ExcludeInteractiveBrowserCredential property to false when passing DefaultAzureCredentialOptions.

Constructors

DefaultAzureCredential(Boolean)

Creates an instance of the DefaultAzureCredential class.

DefaultAzureCredential(DefaultAzureCredentialOptions)

Creates an instance of the DefaultAzureCredential class.

Methods

GetToken(String[], CancellationToken) (Inherited from TokenCredential)
GetToken(TokenRequestContext, CancellationToken)

Sequentially calls GetToken(TokenRequestContext, CancellationToken) on all the included credentials in the order EnvironmentCredential, ManagedIdentityCredential, SharedTokenCacheCredential, and InteractiveBrowserCredential returning the first successfully obtained AccessToken. This method is called by Azure SDK clients. It isn't intended for use in application code.

GetTokenAsync(String[], CancellationToken) (Inherited from TokenCredential)
GetTokenAsync(TokenRequestContext, CancellationToken)

Sequentially calls GetToken(TokenRequestContext, CancellationToken) on all the included credentials in the order EnvironmentCredential, ManagedIdentityCredential, SharedTokenCacheCredential, and InteractiveBrowserCredential returning the first successfully obtained AccessToken. This method is called by Azure SDK clients. It isn't intended for use in application code.

Applies to