如何获取详细的 VM 大小信息
How to get detailed VM Size information
我想使用 Python Azure SDK 来查找支持增强型网络以及 AVX-512 的 VM 大小。到目前为止,我看到的查询有关 VM 大小的信息的方法是 ComputeManagementClient.virtual_machine_sizes.list(region)。但是,返回的信息不包括每种 VM 类型是否支持增强网络,或者是否支持 AVX-512。
这是 virtual_machine_sizes.list 的一个条目提供的示例:
{'name': 'Standard_M208ms_v2', 'numberOfCores': 208, 'osDiskSizeInMB': 1047552, 'resourceDiskSizeInMB': 4194304, 'memoryInMB': 5836800, 'maxDataDiskCount': 64}
我在 https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list 上发现资源 SKU 列表可能会提供我正在寻找的信息。但是,我没有看到在 Python SDK 中使用该资源 SKU 列表功能的方法。
我正在使用 Python 的 azure 库的 4.0.0 版。通过以下方式安装:
pip3 install -Iv azure==4.0.0
提前感谢您提供的任何帮助!
如果要列出python的azure vm资源sku,请参考以下步骤:
- 创建服务主体并将贡献者角色分配给 sp
az login
#create sp and assign Contributor role at subscription level
az ad sp create-for-rbac -n "your service principal name"
- 代码
from azure.mgmt.compute import ComputeManagementClient
from azure.common.credentials import ServicePrincipalCredentials
client_id = "sp appId"
secret = "sp password"
tenant = "sp tenant"
credentials = ServicePrincipalCredentials(
client_id = client_id,
secret = secret,
tenant = tenant
)
Subscription_Id = ''
compute_client =ComputeManagementClient(credentials,Subscription_Id)
resource_group_name='Networking-WebApp-AppGW-V1-E2ESSL'
virtual_machine_scale_set_name='VMSS'
results = compute_client.resource_skus.list(raw=True)
resourceSkusList = [result.as_dict() for result in results]
r=json.dumps(resourceSkusList)
print(r)
详情请参考here。
我想使用 Python Azure SDK 来查找支持增强型网络以及 AVX-512 的 VM 大小。到目前为止,我看到的查询有关 VM 大小的信息的方法是 ComputeManagementClient.virtual_machine_sizes.list(region)。但是,返回的信息不包括每种 VM 类型是否支持增强网络,或者是否支持 AVX-512。
这是 virtual_machine_sizes.list 的一个条目提供的示例:
{'name': 'Standard_M208ms_v2', 'numberOfCores': 208, 'osDiskSizeInMB': 1047552, 'resourceDiskSizeInMB': 4194304, 'memoryInMB': 5836800, 'maxDataDiskCount': 64}
我在 https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list 上发现资源 SKU 列表可能会提供我正在寻找的信息。但是,我没有看到在 Python SDK 中使用该资源 SKU 列表功能的方法。
我正在使用 Python 的 azure 库的 4.0.0 版。通过以下方式安装:
pip3 install -Iv azure==4.0.0
提前感谢您提供的任何帮助!
如果要列出python的azure vm资源sku,请参考以下步骤:
- 创建服务主体并将贡献者角色分配给 sp
az login
#create sp and assign Contributor role at subscription level
az ad sp create-for-rbac -n "your service principal name"
- 代码
from azure.mgmt.compute import ComputeManagementClient
from azure.common.credentials import ServicePrincipalCredentials
client_id = "sp appId"
secret = "sp password"
tenant = "sp tenant"
credentials = ServicePrincipalCredentials(
client_id = client_id,
secret = secret,
tenant = tenant
)
Subscription_Id = ''
compute_client =ComputeManagementClient(credentials,Subscription_Id)
resource_group_name='Networking-WebApp-AppGW-V1-E2ESSL'
virtual_machine_scale_set_name='VMSS'
results = compute_client.resource_skus.list(raw=True)
resourceSkusList = [result.as_dict() for result in results]
r=json.dumps(resourceSkusList)
print(r)
详情请参考here。