Share via

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
Jan 10, 2024, 5:41 AM

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,514 questions
0 comments No comments
{count} votes

2 answers

Sort by: Newest
  1. Prrudram-MSFT 27,961 Reputation points
    Jan 23, 2024, 8:32 AM

    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

  2. Azar 26,350 Reputation points MVP
    Jan 10, 2024, 8:46 AM

    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.


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.