Problem to see my Azure Subscription on Azure CLI or Vscode in Azure VM

Mohsen Akhavan 791 Reputation points
2022-02-23T10:05:56.587+00:00

On my local pc, I connected to my Azure account with Azure CLI. I can see all my subscriptions like the below screenshot:

177135-image.png

But, I have a VM on Azure and I connected to my account with Azure CLI, I couldn't see all my subscriptions.

177162-image.png

On this VM, I tried to log in with Vscode but I have the same problem.

177181-image.png

Just for your information, when I log in with browser and portal.azure.com on this VM, everything is fine.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,796 questions
0 comments No comments
{count} votes

Accepted answer
  1. KarishmaTiwari-MSFT 19,872 Reputation points Microsoft Employee
    2022-02-23T19:59:20.087+00:00

    Issue Description : You are able to see all your Azure subscriptions on local PC using Azure CLI but when you try to do the same on an Azure VM, it does not show all subscriptions.

    Suggested solution :
    Use the following Azure CLI commands to clear the local context and then login with your Tenant ID and displaying the Subscription list under that tenant.

    az local-context show
    az local-context delete --all
    az login --tenant <TenantID>
    az account subscription list

    Please try the above and let me know if you are still seeing the issue and I can further investigate.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.