Class ClientSecretCredential | Azure SDK for Net

Posted by Erma Hippe on Tuesday, June 25, 2024
Inheritance

ClientSecretCredential

Namespace: Azure.Identity
Assembly: Azure.Identity.dll
Syntax
public class ClientSecretCredential : Azure.Core.TokenCredential

Constructors

ClientSecretCredential()

Protected constructor for mocking.

Declaration
protected ClientSecretCredential ();

ClientSecretCredential(String, String, String)

Creates an instance of the ClientSecretCredential with the details needed to authenticate against Azure Active Directory with a client secret.

Declaration
public ClientSecretCredential (string tenantId, string clientId, string clientSecret);
Parameters
String tenantId

The Azure Active Directory tenant (directory) Id of the service principal.

String clientId

The client (application) ID of the service principal

String clientSecret

A client secret that was generated for the App Registration used to authenticate the client.

ClientSecretCredential(String, String, String, TokenCredentialOptions)

Creates an instance of the ClientSecretCredential with the details needed to authenticate against Azure Active Directory with a client secret.

Declaration
public ClientSecretCredential (string tenantId, string clientId, string clientSecret, Azure.Identity.TokenCredentialOptions options);
Parameters
String tenantId

The Azure Active Directory tenant (directory) Id of the service principal.

String clientId

The client (application) ID of the service principal

String clientSecret

A client secret that was generated for the App Registration used to authenticate the client.

TokenCredentialOptions options

Options that allow to configure the management of the requests sent to the Azure Active Directory service.

Methods

GetToken(TokenRequestContext, CancellationToken)

Obtains a token from the Azure Active Directory service, using the specified client secret to authenticate. This method is called by Azure SDK clients. It isn't intended for use in application code.

Declaration
public override Azure.Core.AccessToken GetToken (Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = null);
Parameters
Azure.Core.TokenRequestContext requestContext

The details of the authentication request.

CancellationToken cancellationToken

A CancellationToken controlling the request lifetime.

Returns

GetTokenAsync(TokenRequestContext, CancellationToken)

Obtains a token from the Azure Active Directory service, using the specified client secret to authenticate. This method is called by Azure SDK clients. It isn't intended for use in application code.

Declaration
[System.Diagnostics.DebuggerStepThrough] public override System.Threading.Tasks.ValueTask<Azure.Core.AccessToken> GetTokenAsync (Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken = null);
Parameters
Azure.Core.TokenRequestContext requestContext

The details of the authentication request.

CancellationToken cancellationToken

A CancellationToken controlling the request lifetime.

Returns

ncG1vNJzZmiZqqq%2Fpr%2FDpJuom6Njr627wWeaqKqVY8SqusOorqxmnprBcHDWnplonJ%2Bpu6bAjnqxrqqVY5alsc2toK2xX2Z7cXqPaJipoV92x7a%2BxGeAnZ2eqba1xY56sa6qlWOWpbHNraCtsV54uaqxza2KnpuimsGEvsSdnKesmZa5b7TTpqM%3D