0

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!

Neel
  • 53
  • 4
  • 2
    No, this doesnt make sense, as some location dont have all the vms. if oyu are looking for a list of all possible vm sizes your best bet is documentation – 4c74356b41 May 02 '18 at 19:25

1 Answers1

0

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.

Saher Ahwal
  • 9,015
  • 32
  • 84
  • 152
  • Thanks!. But is there some URL which I can used to retrieve ALL VM sizes (not just specific to a location)? I don't want to send so many Http calls from my application just to retrieve a list of all possible VM sizes. – Neel May 02 '18 at 17:59
  • @Neelambuj what's your scenario? What are you trying to achieve? – Saher Ahwal May 02 '18 at 18:24
  • I have a set of VM sizes which will be uploaded in my application via file upload. I am trying to validate whether the VM sizes are valid by calling the azure API. I dont want to call the API for each location. Rather, I want to make one call which will give me the list of all the vm sizes irrespective of any locaton. I will use this list for validation purpose. – Neel May 07 '18 at 10:44
  • But you only need to call this once, no? and keep it cached in memory or persist it. – Saher Ahwal May 08 '18 at 00:25