Class VisualStudioCredential
Enables authentication to Microsoft Entra ID using data from Visual Studio 2017 or later. See for more information on how to configure Visual Studio for Azure development.
Inheritance
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Identity.dll
Syntax
public class VisualStudioCredential : Azure.Core.TokenCredential
Constructors
VisualStudioCredential()
VisualStudioCredential(VisualStudioCredentialOptions)
Creates a new instance of the VisualStudioCredential with the specified options.
Declaration
public VisualStudioCredential (Azure.Identity.VisualStudioCredentialOptions options);
Parameters
|
VisualStudioCredentialOptions
options
Options for configuring the credential. |
Methods
GetToken(TokenRequestContext, CancellationToken)
Obtains a access token from account signed in to Visual Studio.
Declaration
public override Azure.Core.AccessToken GetToken (Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
Parameters
|
Azure.Core.TokenRequestContext
requestContext
The details of the authentication request. |
|
System.Threading.CancellationToken
cancellationToken
A System.Threading.CancellationToken controlling the request lifetime. |
Returns
|
Azure.Core.AccessToken
An Azure.Core.AccessToken which can be used to authenticate service client calls. |
Exceptions
|
AuthenticationFailedException
Thrown when the authentication failed. |
GetTokenAsync(TokenRequestContext, CancellationToken)
Obtains a access token from account signed in to Visual Studio.
Declaration
[System.Diagnostics.DebuggerStepThrough]
public override System.Threading.Tasks.ValueTask<Azure.Core.AccessToken> GetTokenAsync (Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken);
Parameters
|
Azure.Core.TokenRequestContext
requestContext
The details of the authentication request. |
|
System.Threading.CancellationToken
cancellationToken
A System.Threading.CancellationToken controlling the request lifetime. |
Returns
|
System.Threading.Tasks.ValueTask<Azure.Core.AccessToken>
An Azure.Core.AccessToken which can be used to authenticate service client calls. |
Exceptions
|
AuthenticationFailedException
Thrown when the authentication failed. |