az commands always empty despite having VMs
See original GitHub issueDescribe the bug
I’ve encountered a very strange issue where I can use az resource list
to show all of my resources and it shows me a few VMs. However, when I use az vm list
I always get an empty list []
returned to me regardless of the fact that there are VMs and I can access them via the web interface. I’ve tried specifying the resource group, running queries, and nothing seems to make a difference. I’ve also experienced similar issues with az network ...
commands. Some commands do work like az storage account list
, az account list
, and az group list
.
Here is a shot of az resource list with sensitive details blurred. We can see that there are multiple Microsoft.ClassicNetwork/virtualNetworks:
To Reproduce
az login
az account set --subscription <subscription_id>
az resource list
az vm list
Expected behavior
A JSON list of the VMs. One for each VM shown in the az resource list
.
Environment summary Using 2.0.32 Azure CLI on Mac. I also tried on Windows and got the same result. I also tried using the Azure Cloud Shell and got the same result.
Additional context I have a contributor role, not an owner role. Not sure if this could be an issue, but based on the role permissions it seems like it should not be a factor.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
I am having this same issue with the CLI.
az account list returns my subscriptions, but no other list command returns anything. Is there a solution to fix this? I have uninstalled and reinstalled the CLI even, but I’m getting the same issue. I have owner IAM control over all these resources as well.
@mgeorgebrown89, try deleting your ~/.azure directory and run az login again. (in my case I completely re-installed the az cli, but I think only removing the .azure dir may have been sufficient.)