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

Pallab Chakraborty 401 Reputation points
2021-03-07T04:20:54.777+00:00

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
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
645 questions
0 comments No comments
{count} votes

Accepted answer
  1. shiva patpi 13,141 Reputation points Microsoft Employee
    2021-03-08T01:39:26.863+00:00

    Hello @Anonymous ,
    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful