How to connect to the Azure subscription using Azure CLI in PowerShell?

To connect to the specific azure subscription using Az CLI we need to use “Az account set” command but before using this command make sure you are connected with the Azure cloud using “az login” account.

az account set --subscription 'subscription name or id'

You can also use -s instead of --subscription.

az account set -s 'subscription name or id'

To check if the subscription is set properly, use the below command.

PS C:\> az account show -otable