Neel
Neel

Reputation: 53

Get VMSize List from Azure for all locations

Currently Azure exposes one API to fetch all of the VM Sizes. The API is dependent on a parameter i.e location.

Microsoft Documentation

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes?api-version=2017-12-01

Is there a way I can fetch all the VM Sizes without passing the location? i.e is there a way I can find out all the VM sizes irrespective of any location? Thanks for any help in advance!

Upvotes: 0

Views: 303

Answers (1)

Saher Ahwal
Saher Ahwal

Reputation: 9237

You first list the locations in the subscription. https://learn.microsoft.com/en-us/rest/api/resources/subscriptions/listlocations

Then for each location you list the VM sizes. You can keep track of duplicates yourself of VM sizes that exist in multiple locations. https://learn.microsoft.com/en-us/rest/api/compute/virtualmachinesizes/list

You can see the answer here for example of how to list locations.

Upvotes: 0

Related Questions