Udostępnij za pośrednictwem


How to set Azure BASH to a specific Azure subscription

At the top right of the Azure Management portal here, you will see the Cloud Shell item, Figure 1, click it.

image

Figure 1, Open BASH Cloud Shell in Azure Management Portal

Enter the following command to list out all the subscriptions which are linked to the ID used to access the portal.

 
az account list

The output will resemble something similar to Figure 2.

image

Figure 2, BASH Cloud Shell in Azure Management Portal, list subscriptions

Execute this BASH command to set the subscription context, see Figure 3.

 
az account set --subscription 25ec5bae-####-####-##########

image

Figure 3, BASH Cloud Shell in Azure Management Portal, set subscription

Then use this command to show the current subscription which confirms the correct context is set.

 
az account show

Now, you can configure your Azure resources in that subscription.