我无法让Azure资源API像它承诺的那样返回全部字段列表。API的地址。
https:/docs.microsoft.comen-usrestapiresourcesresourceslist(资源列表)
我在打电话。
https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?api-version=2019-10-01&%24filter=resourceType%20eq%20'Microsoft.Compute%2FvirtualMachines'
它给了我一个表格中的列表。
{
"value": [
{
"type": "Microsoft.Compute/virtualMachines",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/xxx-x-xxx-xxxxxxx/providers/Microsoft.Compute/virtualMachines/xxx-x-xxx-xxxxx",
"name": "xxx-x-xxx-xxxxx",
"location": "xxxxxxx",
"zones": [
"1"
],
"plan": {
"name": "xxxxxxx",
"product": "xxxxxxx",
"publisher": "xxxxxxx"
},
"tags": {
"MYID": "xxxxxxx"
}
}
我错过的是一些信息,例如: 虚拟机大小 (SKU内)。
我试着添加 $expand
参数,但它只适用于有
只有通过$expand查询参数请求时才会出现。
在其描述中。例子有 createdTime
和 changedTime
.
我知道其余的参数应该总是被返回。但它们没有。有人知道我做错了什么吗?
我相信默认的REST API规范模式为 资源 - 列表 不捕捉VMsize SKU。您可以利用 虚拟机 - 列出所有 它提供的VMsize SKU的输出格式如下所示。
{
"name": "xxxxxxxxxxxx",
"id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxxxxxxx/providers/Microsoft.Compute/virtualMachines/xxxxxxxxxxxx",
"type": "Microsoft.Compute/virtualMachines",
"location": "xxxxxxxxxxxx",
"tags": {
"xxxxxxxxxxxx": "xxxxxxxxxxxx",
},
"properties": {
"vmId": "xxxxxxxxxxxxxxxxxxxxxxxxx",
"hardwareProfile": {
"vmSize": "xxxxxxxxxxxx"
},
...
...
...
}
}