AzureActiveDirectorySqlAuthProvider

Provides a custom authentication method that gets a from Azure Identity for the executing context.

Syntax

public class AzureActiveDirectorySqlAuthProvider : SqlAuthenticationProvider

Inheritance

Methods

AcquireTokenAsync

public override Task<SqlAuthenticationToken> AcquireTokenAsync(SqlAuthenticationParameters parameters)
Request token from the provider using the specified . Uses DefaultAzureCredential to obtain an access token for SQL Database authentication.

Parameters

Returns

Task<SqlAuthenticationToken> A SqlAuthenticationToken containing the access token and expiration time.

IsSupported

public override bool IsSupported(SqlAuthenticationMethod authenticationMethod)
Returns a flag indicating if the requested is supported by this custom . This provider supports ActiveDirectoryDeviceCodeFlow authentication method.

Parameters

Returns

bool True if the authentication method is ActiveDirectoryDeviceCodeFlow; otherwise, false.