Microsoft。Common.ResourceGroupSelector UI 元素

ResourceGroupSelector用户界面(UI)元素允许用户选择已有资源组或创建新资源组。 它是表单不使用复合 Microsoft.Common.ResourceScope 元素时使用的独立资源组选择器。

UI 示例

ResourceGroupSelector 元素渲染一个资源组下拉菜单,包含现有和新的资源组模式。

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

Schema

{
  "name": "resourceGroup",
  "type": "Microsoft.Common.ResourceGroupSelector",
  "allowedMode": "Both",
  "scope": {
    "subscriptionId": "[steps('basics').subscription.subscriptionId]"
  },
  "constraints": {
    "validations": [
      {
        "isValid": "[not(empty(steps('basics').resourceGroup.value.name))]",
        "message": "Select or create a resource group."
      }
    ]
  },
  "visible": true
}

示例输出

{
  "mode": "New",
  "value": {
    "name": "example-rg",
    "location": "chinanorth2",
    "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg"
  }
}

Remarks

  • scope.subscriptionId 必须,并且应引用所选订阅。
  • allowedMode 控制用户是否可以创建资源组、使用现有资源组,或两者兼有。 有效值为:BothCreateNewUseExisting
  • 引用资源组ID 。[steps('basics').resourceGroup.value.resourceId]
  • 用 来引用资源组名称 [steps('basics').resourceGroup.value.name]
  • 用 来引用选择模式 [steps('basics').resourceGroup.mode]
  • 如果资源组是新的,将该元素Microsoft.Common.LocationSelector与 配对,并在 时mode使用该位置New

后续步骤