如何获取详细的VM大小信息

时间:2020-08-09 01:25:55

标签: azure-sdk-python

我想使用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上发现,也许资源清单可以提供我想要的信息。但是,我看不到在Python SDK中使用该资源清单列表功能的方法。

我正在使用Python的Azure库4.0.0版本。通过以下方式安装:

pip3 install -Iv azure==4.0.0

在此先感谢您提供的任何帮助!

1 个答案:

答案 0 :(得分:0)

如果要使用python列出Azure虚拟机资源sku,请参考以下步骤:

  1. 创建服务主体,并将贡献者角色分配给sp
min-width: 100%;

enter image description here

  1. 代码
az login
#create sp and assign Contributor role at subscription level
az ad sp create-for-rbac -n "your service principal name"

enter image description here

有关更多详细信息,请参阅here