Share via


AuthenticationFactory.Authenticate Method

Definition

Overloads

Authenticate(IAzureAccount, IAzureEnvironment, String, SecureString, String, Action<String>, IDictionary<String,Object>)

Authenticates an Azure account, service principal, or managed identity against Entra ID and obtains an access token. This method supports claims challenge for conditional access scenarios and various authentication flows based on account type.

Authenticate(IAzureAccount, IAzureEnvironment, String, SecureString, String, Action<String>, String)

Authenticates an Azure account, service principal, or managed identity against Entra ID and obtains an access token.

Authenticate(IAzureAccount, IAzureEnvironment, String, SecureString, String, Action<String>, IAzureTokenCache, String)

Authenticates an Azure account, service principal, or managed identity against Entra ID and obtains an access token.

Authenticate(IAzureAccount, IAzureEnvironment, String, SecureString, String, Action<String>, IDictionary<String,Object>)

Authenticates an Azure account, service principal, or managed identity against Entra ID and obtains an access token. This method supports claims challenge for conditional access scenarios and various authentication flows based on account type.

public Microsoft.Azure.Commands.Common.Authentication.IAccessToken Authenticate(Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount account, Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment environment, string tenant, System.Security.SecureString password, string promptBehavior, Action<string> promptAction, System.Collections.Generic.IDictionary<string,object> optionalParameters);
abstract member Authenticate : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment * string * System.Security.SecureString * string * Action<string> * System.Collections.Generic.IDictionary<string, obj> -> Microsoft.Azure.Commands.Common.Authentication.IAccessToken
override this.Authenticate : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment * string * System.Security.SecureString * string * Action<string> * System.Collections.Generic.IDictionary<string, obj> -> Microsoft.Azure.Commands.Common.Authentication.IAccessToken
Public Function Authenticate (account As IAzureAccount, environment As IAzureEnvironment, tenant As String, password As SecureString, promptBehavior As String, promptAction As Action(Of String), optionalParameters As IDictionary(Of String, Object)) As IAccessToken

Parameters

account
IAzureAccount

The Azure account to authenticate.

environment
IAzureEnvironment

The Azure environment to authenticate against.

tenant
String

The tenant ID or name to authenticate with.

password
SecureString

The password for the account, if applicable.

promptBehavior
String

The prompt behavior to use during authentication.

promptAction
Action<String>

Action to execute when a prompt is required.

optionalParameters
IDictionary<String,Object>

Dictionary of optional parameters that may include:

  • tokenCache (IAzureTokenCache): The token cache to use for caching authentication results.
  • resourceId (string): The resource identifier to authenticate for.
  • claimsChallenge (string): Claims challenge token from a previous authentication attempt requiring additional claims.
  • cmdletContext (ICmdletContext): Context for the cmdlet executing the authentication.

Returns

An access token for the authenticated principal.

Implements

Applies to

Authenticate(IAzureAccount, IAzureEnvironment, String, SecureString, String, Action<String>, String)

Authenticates an Azure account, service principal, or managed identity against Entra ID and obtains an access token.

public Microsoft.Azure.Commands.Common.Authentication.IAccessToken Authenticate(Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount account, Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment environment, string tenant, System.Security.SecureString password, string promptBehavior, Action<string> promptAction, string resourceId = "ActiveDirectoryServiceEndpointResourceId");
abstract member Authenticate : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment * string * System.Security.SecureString * string * Action<string> * string -> Microsoft.Azure.Commands.Common.Authentication.IAccessToken
override this.Authenticate : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment * string * System.Security.SecureString * string * Action<string> * string -> Microsoft.Azure.Commands.Common.Authentication.IAccessToken
Public Function Authenticate (account As IAzureAccount, environment As IAzureEnvironment, tenant As String, password As SecureString, promptBehavior As String, promptAction As Action(Of String), Optional resourceId As String = "ActiveDirectoryServiceEndpointResourceId") As IAccessToken

Parameters

account
IAzureAccount

The Azure account to authenticate.

environment
IAzureEnvironment

The Azure environment to authenticate against.

tenant
String

The tenant ID or name to authenticate with.

password
SecureString

The password for the account, if applicable.

promptBehavior
String

The prompt behavior to use during authentication.

promptAction
Action<String>

Action to execute when a prompt is required.

resourceId
String

The resource identifier to authenticate for.

Returns

An access token for the authenticated principal.

Implements

Applies to

Authenticate(IAzureAccount, IAzureEnvironment, String, SecureString, String, Action<String>, IAzureTokenCache, String)

Authenticates an Azure account, service principal, or managed identity against Entra ID and obtains an access token.

public Microsoft.Azure.Commands.Common.Authentication.IAccessToken Authenticate(Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount account, Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment environment, string tenant, System.Security.SecureString password, string promptBehavior, Action<string> promptAction, Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureTokenCache tokenCache, string resourceId = "ActiveDirectoryServiceEndpointResourceId");
abstract member Authenticate : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment * string * System.Security.SecureString * string * Action<string> * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureTokenCache * string -> Microsoft.Azure.Commands.Common.Authentication.IAccessToken
override this.Authenticate : Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureAccount * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureEnvironment * string * System.Security.SecureString * string * Action<string> * Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureTokenCache * string -> Microsoft.Azure.Commands.Common.Authentication.IAccessToken
Public Function Authenticate (account As IAzureAccount, environment As IAzureEnvironment, tenant As String, password As SecureString, promptBehavior As String, promptAction As Action(Of String), tokenCache As IAzureTokenCache, Optional resourceId As String = "ActiveDirectoryServiceEndpointResourceId") As IAccessToken

Parameters

account
IAzureAccount

The Azure account to authenticate.

environment
IAzureEnvironment

The Azure environment to authenticate against.

tenant
String

The tenant ID or name to authenticate with.

password
SecureString

The password for the account, if applicable.

promptBehavior
String

The prompt behavior to use during authentication.

promptAction
Action<String>

Action to execute when a prompt is required.

tokenCache
IAzureTokenCache

The token cache to use for caching authentication results.

resourceId
String

The resource identifier to authenticate for.

Returns

An access token for the authenticated principal.

Implements

Applies to