1

I have two resource groups in Azure, each contains one VMSS (Virtual Machine Scale Sets) and the resources are visible in Azure Portal. The problem is, the following commands return empty output:

az resource list --subscription MySubscription -g vmss-rg
az vmss list --subscription MySubscription -g vmss-rg
az vmss list

However, running az resource list with different resource groups which doesn't have VMSS works fine. I also tested it with different Azure account and subscription, it also worked.

Bayram
  • 43
  • 2
  • 6
  • We have run the above cmdlets in our subscription, those are working fine & we were able to get the list of VMSS that were present under the subscription. Alternatively could please try the below cmdlet to pull the list of VMSS present under the subscription or in resource group. ``az resource list --resource-type "Microsoft.Compute/virtualMachineScaleSets" -g '' ``(OR)``az resource list --resource-type "Microsoft.Compute/virtualMachineScaleSets"`` – VenkateshDodda Feb 25 '22 at 04:37
  • Do let us know if face any issue while running the above cmdlets – VenkateshDodda Feb 25 '22 at 04:38
  • @VenkateshDodda-MT the result is the same: empty list. – Bayram Feb 25 '22 at 12:53
  • are you trying to run these cmdlets from the local machine through PowerShell or from the cloud shell in the portal . if you are running from the local PowerShell have you installed az modules ? – VenkateshDodda Feb 25 '22 at 13:01
  • I have Azure CLI installed on my local machine, and I user GitBash and/or PowerShell to invoke azure cli commands. I don't use "Azure Az PowerShell module". Btw, I tried the same commands in the Cloud Shell in the portal and it worked. Actually it was working on the local machine as well about a month ago. – Bayram Feb 25 '22 at 15:34
  • Almost a week after creation of the VMSS resources, now it shows properly. PS: I didn't update/upgrade any module, it just worked after a week. – Bayram Feb 28 '22 at 11:10

1 Answers1

1

We have tested the same command in our local as suggested by @VenkateshDodda-MT and it works fine. Posting it as an answer to help other community members for the similar issue so that they can find and fix their problem.

To achieve the above requirement we need to install the az powershell module in our local .

Post that run the command in powershell to get the vmss list under our subscription or resource groups:-

az resource list --resource-type  "Microsoft.Compute/virtualMachineScaleSets"

OUTPUT:-

enter image description here

To get the VMSS list under particular resource group run the below cmd:

az resource list --resource-type  "Microsoft.Compute/virtualMachineScaleSets" -g '<rgName>'

OUTPUT:- enter image description here

For more information please refer this SO THREAD:Azure PS command returns empty list as suggested by @Olga Osinskaya - MSFT

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15