question

pallab avatar image
0 Votes"
pallab asked ·

How to retrieve all the VM Sizes starting with Standard_M using Azure CLI

I would like to retrieve all the VM SKUs starting with Standard_M. I wrote the below query in AZ CLI but it didn't display me any result. Any idea how to use the wildcard in a JMES Query

My Query :

az vm list-sizes --location canadacentral -o table --query "[?contains(name, 'Standard_M*')]"


I get output if i give the full VM SKU as shown below :

az vm list-sizes --location canadacentral -o table --query "[?contains(name, 'Standard_M64dms_v2')]"
Name NumberOfCores OsDiskSizeInMb ResourceDiskSizeInMb MemoryInMb MaxDataDiskCount


Standard_M64dms_v2 64 1047552 2097152 1835008 64

But i want to provide wildcards with Standard_M so that it fetches me anything related to Standard_M sizes

azure-cloud-services
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

shivapatpi-MSFT avatar image
1 Vote"
shivapatpi-MSFT answered ·

Hello @pallab ,
Can you try out the alternative query like below ?
Basically list-skus JSON output has got an attribute called family type, so here we are query by 'standardMSFamily' Series family like below.

az vm list-skus --location canadacentral --query "[?family=='standardMSFamily' && resourceType=='virtualMachines'].{Name:name}" --output table

Name



Standard_M8-2ms
Standard_M8-4ms
Standard_M8ms
Standard_M16-4ms
Standard_M16-8ms
Standard_M16ms
Standard_M32-8ms
Standard_M32-16ms
Standard_M32ls
Standard_M32ms
Standard_M32ts
Standard_M64-16ms
Standard_M64-32ms
Standard_M64ls
Standard_M64ms
Standard_M64s
Standard_M128-32ms
Standard_M128-64ms
Standard_M128ms
Standard_M128s
Standard_M64
Standard_M64m
Standard_M128
Standard_M128m


Hope that helps ! Always don't forget to "Upvote and Accept the answer" , so that it can help community out there.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.