In this Azure PowerShell article, we will discuss the syntax and usage of the connect-azaccount PowerShell command with some examples of how to use this command.
Table of Contents
connect-azaccount
The connect-azaccount is a very good PowerShell command that can help you connect to Azure with one particular authenticated account so that you can use the Azure PowerShell commands.
Syntax
Below is the syntax of the connect-azaccount PowerShell command.
connect-azaccount
Connect-AzAccount
-Credential <PSCredential>
-Tenant <String>
Connect-AzAccount
-Tenant <String> [-Subscription <String>]
Let’s discuss a few examples of how to use the Connect-AzAccount PowerShell command.
Example-1
You can run the below Azure PowerShell command to connect to Azure with an Azure account.
Connect-AzAccount
After executing the above PowerShell command, you need to provide the Microsoft account or organizational ID credentials as shown below.

Once signed in successfully, I got the expected output as shown below.
PS C:\WINDOWS\system32> Connect-AzAccount
Account SubscriptionName TenantId Environment
------- ---------------- -------- -----------
fewlines4biju@hotmail.com Visual Studio Enterprise 5d9d690a-0310-474d-ae8b-42df2d549228 AzureCloud
See the same output below

Example-2:
You can also use the tenant and SubscriptionId with the Connect-AzAccount PowerShell command.
Connect-AzAccount -Tenant '5d9d690a-0310-474d-ae8b-42df2d549228' -SubscriptionId '1cdf4300-dee5-4518-9c9c-feaa72a5cbd1'
After executing the above PowerShell command, I got the expected output

Once you are done, you can use the Disconnect-AzAccount PowerShell command to disconnect from the Azure account that you are connected to.
You may also like following the below articles
Final Thoughts
In this Azure PowerShell article, we discussed the syntax and usage of the connect-azaccount PowerShell command with examples of how to use this command. Thanks for reading this article !!!