Class ManagedIdentityCredential | Azure SDK for Net

Publish date: 2024-05-11
Inheritance

ManagedIdentityCredential

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

Constructors

ManagedIdentityCredential()

Protected constructor for mocking.

Declaration
protected ManagedIdentityCredential ();

ManagedIdentityCredential(String, TokenCredentialOptions)

Creates an instance of the ManagedIdentityCredential capable of authenticating a resource with a managed identity.

Declaration
public ManagedIdentityCredential (string clientId = null, Azure.Identity.TokenCredentialOptions options = null);
Parameters

Methods

GetToken(TokenRequestContext, CancellationToken)

Obtains an AccessToken from the Managed Identity service if available. This method is called automatically by Azure SDK client libraries. You may call this method directly, but you must also handle token caching and token refreshing.

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

GetTokenAsync(TokenRequestContext, CancellationToken)

Obtains an AccessToken from the Managed Identity service if available. This method is called automatically by Azure SDK client libraries. You may call this method directly, but you must also handle token caching and token refreshing.

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

ncG1vNJzZmiZqqq%2Fpr%2FDpJuom6Njr627wWeaqKqVY8SqusOorqxmnprBcHDWnplonJ%2Bpu6bAjnqxrqqVY5alsc2toK2xX2Z7dHqPaJipoV92x7a%2BxGeAnZ2eqba1xY56sa6qlWOWpbHNraCtsV6Crq%2Btxp6bgpyVo8GqwNh8qZ6claPBqq3LZ5%2BtpZw%3D