Class ClientCertificateCredential
Enables authentication of a service principal in to Azure Active Directory using a X509 certificate that is assigned to it's App Registration. More information on how to configure certificate authentication can be found here: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-certificate-credentials#register-your-certificate-with-azure-ad
Namespace: Azure.Identity
Assembly: Azure.Identity.dll
Syntax
public class ClientCertificateCredential : Azure.Core.TokenCredential
Constructors
ClientCertificateCredential()
Protected constructor for mocking.
Declaration
protected ClientCertificateCredential ();
ClientCertificateCredential(String, String, X509Certificate2)
Creates an instance of the ClientCertificateCredential with the details needed to authenticate against Azure Active Directory with the specified certificate.
Declaration
public ClientCertificateCredential (string tenantId, string clientId, System.Security.Cryptography.X509Certificates.X509Certificate2 clientCertificate);
Parameters
String
tenantId
The Azure Active Directory tenant (directory) Id of the service principal. |
String
clientId
The client (application) ID of the service principal |
X509Certificate2
clientCertificate
The authentication X509 Certificate of the service principal |
ClientCertificateCredential(String, String, X509Certificate2, TokenCredentialOptions)
Creates an instance of the ClientCertificateCredential with the details needed to authenticate against Azure Active Directory with the specified certificate.
Declaration
public ClientCertificateCredential (string tenantId, string clientId, System.Security.Cryptography.X509Certificates.X509Certificate2 clientCertificate, 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 |
X509Certificate2
clientCertificate
The authentication X509 Certificate of the service principal |
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 X509 certificate 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
AccessToken
An AccessToken which can be used to authenticate service client calls. |
GetTokenAsync(TokenRequestContext, CancellationToken)
Obtains a token from the Azure Active Directory service, using the specified X509 certificate 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
ValueTask<AccessToken>
An AccessToken which can be used to authenticate service client calls. |