Class VisualStudioCredential
Enables authentication to Microsoft Entra ID using data from Visual Studio 2017 or later. See https://learn.microsoft.com/dotnet/azure/configure-visual-studio for more information on how to configure Visual Studio for Azure development.
public class VisualStudioCredential : TokenCredential
- Inheritance
-
VisualStudioCredential
Constructors
VisualStudioCredential()
Creates a new instance of the VisualStudioCredential.
public VisualStudioCredential()
VisualStudioCredential(VisualStudioCredentialOptions)
Creates a new instance of the VisualStudioCredential with the specified options.
public VisualStudioCredential(VisualStudioCredentialOptions options)
Parameters
options
VisualStudioCredentialOptionsOptions for configuring the credential.
Methods
GetToken(TokenRequestContext, CancellationToken)
Gets an Azure.Core.AccessToken for the specified set of scopes.
public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)
Parameters
requestContext
TokenRequestContextThe Azure.Core.TokenRequestContext with authentication information.
cancellationToken
CancellationTokenThe CancellationToken to use.
Returns
- AccessToken
A valid Azure.Core.AccessToken.
Remarks
Caching and management of the lifespan for the Azure.Core.AccessToken is considered the responsibility of the caller: each call should request a fresh token being requested.
GetTokenAsync(TokenRequestContext, CancellationToken)
Gets an Azure.Core.AccessToken for the specified set of scopes.
public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
Parameters
requestContext
TokenRequestContextThe Azure.Core.TokenRequestContext with authentication information.
cancellationToken
CancellationTokenThe CancellationToken to use.
Returns
- ValueTask<AccessToken>
A valid Azure.Core.AccessToken.
Remarks
Caching and management of the lifespan for the Azure.Core.AccessToken is considered the responsibility of the caller: each call should request a fresh token being requested.