Microsoft。Common.LocationSelector UI 元素

LocationSelector用户界面(UI)元素允许用户为订阅选择 Azure 区域。 它是当表单不使用复合 Microsoft.Common.ResourceScope 元素时使用的独立区域选择器。

UI 示例

LocationSelector 元素渲染一个区域下拉菜单。

Microsoft的截图。Common.LocationSelector UI 元素。

Schema

{
  "name": "location",
  "type": "Microsoft.Common.LocationSelector",
  "label": "Region",
  "toolTip": "Select the Azure region for the resources.",
  "resourceTypes": [
    "Microsoft.Storage/storageAccounts"
  ],
  "allowedValues": [
    "chinanorth2",
    "chinaeast2"
  ],
  "scope": {
    "subscriptionId": "[steps('basics').subscription.subscriptionId]"
  },
  "visible": true
}

示例输出

{
  "name": "chinanorth2",
  "displayName": "China North 2"
}

Remarks

  • scope.subscriptionId 必须,并且应引用所选订阅。
  • resourceTypes 将区域筛选到支持上述资源类型的地点。
  • allowedValues 可选地将区域限制为明确的地点名称列表。 它可以是一个数组,也可以是一个将 值计算到数组的表达式。
  • 用类似 [steps('basics').location.name]的表达式引用所选地点名称。
  • 对于资源组部署,当资源组新建或模板需要明确部署位置时,使用所选位置 view.outputs.location

后续步骤