Skip to content

Instantly share code, notes, and snippets.

@fitzgeraldsteele
Created January 20, 2018 01:57
Show Gist options
  • Save fitzgeraldsteele/b8adbcec2168d85f3bb71d8f109f739b to your computer and use it in GitHub Desktop.
Save fitzgeraldsteele/b8adbcec2168d85f3bb71d8f109f739b to your computer and use it in GitHub Desktop.
Get a list of Azure VM Skus for a particular Azure region
# Get a list of Azure VM Skus for a particular region
from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.compute import ComputeManagementClient
client = get_client_from_cli_profile(ComputeManagementClient)
SUBID = 'YOUR-SUBSCRIPTION-ID'
LOCATION = 'eastus2'
sizeitr = client.virtual_machine_sizes.list(LOCATION, subscription_id = SUBID)
sizes = [i.name for i in sizeitr]
sizesorted = sorted(sizes)
for s in sizesorted:
print(s)
print (len(sizesorted))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment