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.