
The secondĬommand connects the specified Azure tenant using the service principal credentials stored in the The first command stores the service principal credentials in the $Credential variable. Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud Example 3: Connect to Azure using a service principal account $Credential = Get-CredentialĬonnect-AzAccount -Credential $Credential This accountĪuthenticates with Azure using organizational ID credentials. The second commandĬonnects to an Azure account using the credentials stored in $Credential. Prompts for user credentials and stores them in the $Credential variable. This scenario works only when the user does not have multi-factor auth turned on. Subscription1 xxxx-xxxx-xxxx-xxxx AzureCloud Example 2: Connect to Azure using organizational ID credentials Connect-AzAccountĪccount SubscriptionName TenantId Environment The interactive option or use service principal authentication. If multi-factor authentication is enabled for your credentials, you must log in using You must provide a Microsoft account or organizational IDĬredentials. This example connects to an Azure account. Examples Example 1: Connect to an Azure account AfterĮxecuting this cmdlet, you can disconnect from an Azure account using Disconnect-AzAccount. Skip this context population, specify the SkipContextPopulation switch parameter. The list of contexts created for the user can be found by running Get-AzContext -ListAvailable.

User, the user's context list is populated with a context for each of their first 25 subscriptions. To add an authenticated account for use with Service Management, use theĪdd-AzureAccount cmdlet from the Azure PowerShell module. You can use this authenticated account only with Azure Resource The Connect-AzAccount cmdlet connects to Azure with an authenticated account for use with cmdletsįrom the Az PowerShell modules. In this article Syntax Connect-Az Account Connect to Azure with an authenticated account for use with cmdlets from the Az PowerShell modules.
