question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az commands always empty despite having VMs

See original GitHub issue

Describe 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: az_resource_list

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:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mgeorgebrown89commented, Dec 5, 2019

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.

0reactions
joshschmittercommented, Jul 29, 2020

@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.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

az vmss list command returns empty value - Microsoft Q&A
az vmss list command returns empty value. I have two resource groups in Azure, each contains one VMSS (Virtual Machine Scale Sets) and...
Read more >
Azure PS command returns empty list - Stack Overflow
However, when running the exact same command in PS, it returns an empty list, even though the resource exists.
Read more >
best practices | Journey Of The Geek
When crafting an Azure Policy, always review the resource properties when the feature or property you want to check is both enabled and...
Read more >
Azure Bastion Step-by Step Guide | Ammar Hasayen
I always like to explain the Why before going to the How part of ... I already have a virtual machine called ManagementVM...
Read more >
Configuring and managing virtualization Red Hat Enterprise ...
Viewing virtual machine information using the command-line interface · 6.2. ... Although still supported in RHEL 8, virt-manager has been deprecated.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found