In Azure Console we have list of supported and unsupported for VM Creation, So Do we have any python SDK or REST API available for this ?

narsimha 20 Reputation points
2024-01-10T05:41:50.3966667+00:00

Hi All,

In Azure console we have a list of supported categories and unsupported categories of VM sizes for VM Creation, So do we have any Azure Python SDK or REST API available for this supported vm sizes list.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,332 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Azar 26,180 Reputation points MVP
    2024-01-10T08:46:53.8466667+00:00

    Hi
    narsimha

    I think there there isn't a specific Azure API or Python SDK method dedicated solely to retrieving a list of supported and unsupported VM sizes for VM creation.

    but, you can try it by using the Azure (ARM) API and Python SDK to query information about available VM sizes.

    Below is how:

    pip install azure-mgmt-compute
    Use Python Script to Retrieve VM Sizes:
    
    
    
    from azure.identity import DefaultAzureCredential
    from azure.mgmt.compute import ComputeManagementClient
    
    subscription_id = 'your_subscription_id'
    resource_group_name = 'your_resource_group_name'
    location = 'your_region'
    
    credential = DefaultAzureCredential()
    compute_client = ComputeManagementClient(credential, subscription_id)
    
    vm_sizes = compute_client.virtual_machine_sizes.list(location, resource_group_name)
    
    print("Supported VM Sizes:")
    for size in vm_sizes:
        print(size.name)
    
    
    

    If this helps kindly accept the answer thanks much.


  2. Prrudram-MSFT 27,786 Reputation points
    2024-01-23T08:32:42.6666667+00:00

    Hi narsimha If I understand correctly, you are looking for Azure Python SDK or Azure rest api to list unsupported VM Sizes in azure as listed in "all sizes" blade like shown in below screenshot?

    There is no direct Azure Python SDK or Rest API for this. You can check the following Stack question which is like your requirement https://stackoverflow.com/questions/69661889/in-azure-i-wanted-to-get-sku-list-for-a-specific-vm-using-python-sdk
    User's image

    If you would like to further check you can try contacting Microsoft support for further assistance.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.