0

How to use azure cli to list the vms of a specific subscription/resource group of their resources used, like size of the VM, and type of OS, etc?

Like in How to get a list of available vm sizes in an azure location, it can only list by azure location, but I want to filter by resource group instead.

and Azure CLI | list resources is totally irrelevant of this question.

Specifically,

  • Given a name of the Subscription,
  • list all resource groups under it, together with
  • the VMs each resource groups contains, and
  • the size of the VM (Both CPU and Disk), and the types of each OS
  • output the above in a hierarchical json data using the command az
xpt
  • 20,363
  • 37
  • 127
  • 216
  • Does this answer your question? [Filtering with Azure CLI and JMESPath](https://stackoverflow.com/questions/59154106/filtering-with-azure-cli-and-jmespath) – Ecstasy Jun 13 '22 at 03:38
  • [How to find resource groups of particular resource in az cli](https://stackoverflow.com/questions/67938286/how-to-find-resource-groups-of-particular-resource-in-az-cli) and [Resource list does not filter correctly on tags](https://github.com/Azure/azure-cli/issues/7674) – Ecstasy Jun 13 '22 at 03:39
  • What is the azure client command you are using at the moment? If you can, provide an anonymised example of the return of it, pointing at the field you want to filter by. – β.εηοιτ.βε Jun 13 '22 at 10:41
  • No , @ DeepDave-MT those are *related*, but none is a direct answer. @β.εηοιτ.βε, please see my updated OP. Hope it answers your inquiry. – xpt Jun 13 '22 at 14:22
  • _list all resource groups under it, together with_ > from what a quick Googling told me it is not possible to nest resources groups, could you please clarify what you meant there? – β.εηοιτ.βε Jun 13 '22 at 18:01
  • 1
    Yes @β.εηοιτ.βε, I meant Subscription, as all resources groups are under Subscriptions. Op changed. – xpt Jun 15 '22 at 01:53

0 Answers0