Search code examples
azureazure-management-api

Programmatically getting the list of azure virtual machine sizes


I am new to Azure management libraries for .net. How can we enumerate VM instance sizes available with respect to subscription or in general using Azure Management libraries for .Net or Rest APIs? Please suggest.


Solution

  • You can get a list of VM sizes for a region by calling

    https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/{location}/vmSizes?api-version={api-version}
    

    As documented here - List all available virtual machine sizes in a region

    There is also a .Net Class for the same, but I've not found any examples of it being used - documented here - VirtualMachineSizeOperationsExtensions.List