Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The subscription of xxx' doesn't exist in cloud 'AzureCloud'

I'm trying to follow the example of how to Install and configure Terraform to provision VMs and other infrastructure into Azure using Azure Cloud shell as described here:

The following command provided the subscription id and tenant id:

az account show --query "{subscriptionId:id, tenantId:tenantId}"

However, the command provided the following error:

The subscription of '' doesn't exist in cloud 'AzureCloud'.

like image 771
barlow1 Avatar asked Aug 18 '18 17:08

barlow1


People also ask

How do I change my cloud shell subscription?

To switch to the subscription you want to work on execute the command az account set --subscription c56e18b5–23ce-4d2c-ac8c-35d3c9bc7e0f (use your own subscription id).

How do I view my Azure subscriptions?

Sign in to the Azure portal. Under the Azure services heading, select Subscriptions. If you don't see Subscriptions here, use the search box to find it. Find the Subscription ID for the subscription shown in the second column.

How do I run AZ login?

To login to the Azure account using Azure CLI, we need to use the az login command. Once you type the az login command, it will prompt for the Azure portal login console. If you need to log in with the device authentication code in the browser, you need to use the parameter –use-device-code.


3 Answers

For anyone finding this question based on the title but with a different problem to the OP.

Symptoms:

  • subscription isn't showing in az account list output
  • az account set -s subscription_id fails with error message in title

Possible solution:

  • You need to re-auth the cli with az login
like image 113
ita Avatar answered Oct 16 '22 10:10

ita


Just log in again

az login

That will update the subscriptions you belong.

like image 43
Christian Altamirano Ayala Avatar answered Oct 16 '22 10:10

Christian Altamirano Ayala


Test the link you posted and get the same error, the screenshot below: enter image description here

It seems that because you are log in to Azure Portal and there is a tenant which you also logged in. If the tenant only has one subscription, then you set the subscription in another tenant with the command az account set --subscription="${SUBSCRIPTION_ID}", you will get the error:

The subscription of 'xxxx' doesn't exist in cloud 'AzureCloud'

You needn't use the command az account set --subscription="${SUBSCRIPTION_ID}" if the tenant only has one subscription. If you want to use, please use the subscription Id show you. The test result as the screenshot below: enter image description here

like image 4
Charles Xu Avatar answered Oct 16 '22 11:10

Charles Xu