Table of Contents

Class DeviceCodeCredentialOptions

Namespace
Azure.Identity
Assembly
Azure.Identity.dll

Options to configure the DeviceCodeCredential.

public class DeviceCodeCredentialOptions : TokenCredentialOptions
Inheritance
DeviceCodeCredentialOptions
Inherited Members

Constructors

DeviceCodeCredentialOptions()

public DeviceCodeCredentialOptions()

Properties

AdditionallyAllowedTenants

Specifies tenants in addition to the specified TenantId for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for any tenant the logged in account can access. If no value is specified for TenantId, this option will have no effect, and the credential will acquire tokens for any requested tenant.

public IList<string> AdditionallyAllowedTenants { get; }

Property Value

IList<string>

AuthenticationRecord

The AuthenticationRecord captured from a previous authentication.

public AuthenticationRecord AuthenticationRecord { get; set; }

Property Value

AuthenticationRecord

ClientId

The client ID of the application used to authenticate the user. If not specified the user will be authenticated with an Azure development application.

public string ClientId { get; set; }

Property Value

string

DeviceCodeCallback

The callback which will be executed to display the device code login details to the user. In not specified the device code and login instructions will be printed to the console.

public Func<DeviceCodeInfo, CancellationToken, Task> DeviceCodeCallback { get; set; }

Property Value

Func<DeviceCodeInfo, CancellationToken, Task>

DisableAutomaticAuthentication

Prevents the DeviceCodeCredential from automatically prompting the user. If automatic authentication is disabled a AuthenticationRequiredException will be thrown from GetToken(TokenRequestContext, CancellationToken) and GetTokenAsync(TokenRequestContext, CancellationToken) in the case that user interaction is necessary. The application is responsible for handling this exception, and calling Authenticate(CancellationToken) or AuthenticateAsync(CancellationToken) to authenticate the user interactively.

public bool DisableAutomaticAuthentication { get; set; }

Property Value

bool

DisableInstanceDiscovery

Gets or sets the setting which determines whether or not instance discovery is performed when attempting to authenticate. Setting this to true will completely disable both instance discovery and authority validation. This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from https://login.microsoft.com/ to validate the authority. By setting this to true, the validation of the authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and trustworthy."

public bool DisableInstanceDiscovery { get; set; }

Property Value

bool

TenantId

The tenant ID the user will be authenticated to. If not specified the user will be authenticated to their home tenant.

public string TenantId { get; set; }

Property Value

string

TokenCachePersistenceOptions

Specifies the TokenCachePersistenceOptions to be used by the credential. If not options are specified, the token cache will not be persisted to disk.

public TokenCachePersistenceOptions TokenCachePersistenceOptions { get; set; }

Property Value

TokenCachePersistenceOptions