ResourceGroupSelector使用者介面(UI)元素讓使用者選擇現有資源群組或建立新的資源群組。 它是當表單不使用複合 Microsoft.Common.ResourceScope 元素時使用的獨立資源群組選擇器。
使用者介面範例
該 ResourceGroupSelector 元素會呈現一個資源群組下拉選單,包含現有與新的資源群組模式。
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": "westus2",
"resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg"
}
}
Remarks
-
scope.subscriptionId必須,且應參考所選訂閱。 -
allowedMode控制使用者是否能建立資源群組、使用現有資源群組,或兩者兼有。 有效值為Both、CreateNew和UseExisting。 - 將資源群組 ID 與 一起引用。
[steps('basics').resourceGroup.value.resourceId] - 將資源群組名稱與
[steps('basics').resourceGroup.value.name]。 - 參考選擇模式。
[steps('basics').resourceGroup.mode] - 如果資源群組是新的,則將此元素
Microsoft.Common.LocationSelector與 配對,並在 為 時New使用該位置mode。