How to manage multiple subscription Ids with az command

If you end up with multiple Azure subscriptions, each time you issue an az cli command, you need to include the subscription ID with the --subscription attribute. If you are going to work in the same subscription for a while, running the az account set --subscription <subscription-id> command allows you to set the default subscription ID that will be used with all az cli commands. This sets the subscription across sessions, so if you are using the Azure Portal Shell and you disconnect and reconnect to the Portal, the previous session you set will still be active.

Below is an example of the command with for subscription ID xxxxxxxx-xxxx-xxxx-xxxx-15a50ca5132d.

az account set --subscription xxxxxxxx-xxxx-xxxx-xxxx-15a50ca5132d

You can find the subscription ID for your subscription by going to Subscriptions on the Azure Portal.

subscription-id.png
Previous
Previous

Set Azure Application Insights application name with Python API