在Azure Cloud Shell中,我可以使用az account list-locations
获取订阅中支持的所有位置的列表。如何过滤响应,使其仅包含位置的name属性,而排除所有其他属性?
而不是像这样的对象列表:
{
"displayName": "UK West",
"id": "<<removed>>",
"latitude": "53.427",
"longitude": "-3.084",
"name": "ukwest",
"subscriptionId": null
}
我想收集这样的名字:
{
"name": "ukwest",
"name": "ukwest2",
"name": "ukwest3",
}
答案 0 :(得分:1)
答案 1 :(得分:1)
接受的答案对我不起作用。
我正在使用az
CLI版本2.3.1。
这对我有用:
az account list-locations --query "sort_by([].{Location:name}, &Location)" -o table
产生以下结果:
Location
------------------
australiacentral
australiacentral2
australiaeast
australiasoutheast
brazilsouth
canadacentral
canadaeast
centralindia
centralus
eastasia
eastus
eastus2
francecentral
francesouth
germanynorth
germanywestcentral
japaneast
japanwest
koreacentral
koreasouth
northcentralus
northeurope
norwayeast
norwaywest
southafricanorth
southafricawest
southcentralus
southeastasia
southindia
switzerlandnorth
switzerlandwest
uaecentral
uaenorth
uksouth
ukwest
westcentralus
westeurope
westindia
westus
westus2
您可以在此处找到有关查询语言的更多详细信息: