Skip to main content

Definition

Assembly: CloudNimble.EasyAF.Data.EF6.dll Namespace: CloudNimble.EasyAF.Data Inheritance: Microsoft.Data.SqlClient.SqlAuthenticationProvider

Syntax

CloudNimble.EasyAF.Data.AzureActiveDirectorySqlAuthProvider

Summary

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

Constructors

.ctor

Syntax

public AzureActiveDirectorySqlAuthProvider()

Methods

AcquireTokenAsync Override

Request token from the provider using the specified SqlAuthenticationParameters. Uses DefaultAzureCredential to obtain an access token for SQL Database authentication.

Syntax

public override System.Threading.Tasks.Task<Microsoft.Data.SqlClient.SqlAuthenticationToken> AcquireTokenAsync(Microsoft.Data.SqlClient.SqlAuthenticationParameters parameters)

Parameters

NameTypeDescription
parametersMicrosoft.Data.SqlClient.SqlAuthenticationParametersThe authentication parameters from SQL Client.

Returns

Type: System.Threading.Tasks.Task<Microsoft.Data.SqlClient.SqlAuthenticationToken> A SqlAuthenticationToken containing the access token and expiration time.

IsSupported Override

Returns a flag indicating if the requested SqlAuthenticationMethod is supported by this custom SqlAuthenticationProvider. This provider supports ActiveDirectoryDeviceCodeFlow authentication method.

Syntax

public override bool IsSupported(Microsoft.Data.SqlClient.SqlAuthenticationMethod authenticationMethod)

Parameters

NameTypeDescription
authenticationMethodMicrosoft.Data.SqlClient.SqlAuthenticationMethodThe authentication method to check for support.

Returns

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