Share via


Microsoft.Solutions.ResourceSelector UI 元素

ResourceSelector 使用者介面 (UI) 元素可讓使用者從訂用帳戶中選取現有的 Azure 資源。 您可以指定資源提供者命名空間和資源類型,例如元素 JSON 中的 Microsoft.Storage/storageAccounts。 您可以使用元素依訂用帳戶或位置篩選清單。 從元素的 UI 中,若要在清單的內容中搜尋,您可以輸入篩選條件,例如資源群組名稱、資源名稱或部分名稱。

UI 範例

在此範例中,元素的位置會設定為 all。 此清單會顯示訂用帳戶中的所有儲存體帳戶。 您可以使用篩選方塊在清單中搜尋。

Screenshot of the resource selector list of all storage accounts in a subscription.

在此範例中,元素的位置會設定為 onBasics。 此清單會顯示存在於 [基本] 索引標籤上所選位置的儲存體帳戶。您可以使用篩選方塊在清單中搜尋。

Screenshot of the resource selector list that filters by resource group name.

當您使用元素來限制 onBasics UI 的訂用帳戶時,不會在清單中顯示訂用帳戶名稱。 您可以使用篩選方塊在清單中搜尋。

Screenshot of the resource list that doesn't show subscription because element set subscription to onBasics.

結構描述

{
  "name": "storageSelector",
  "type": "Microsoft.Solutions.ResourceSelector",
  "label": "Select storage accounts",
  "resourceType": "Microsoft.Storage/storageAccounts",
  "options": {
    "filter": {
      "subscription": "onBasics",
      "location": "onBasics"
    }
  }
}

範例輸出

"id": "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}",
"location": "{deployed-location}",
"name": "{resource-name}"

備註

  • resourceType 屬性中,針對您想在清單中顯示的資源,提供資源提供者命名空間和資源類型名稱。 如需詳細資訊,請參閱資源提供者參考文件。
  • filter 屬性會限制資源的可用選項。 您可以依位置或訂用帳戶來限制結果。
    • all:顯示所有資源,而且是預設值。
    • onBasics:僅顯示符合 [基本] 索引標籤上選取範圍的資源。
    • 如果您省略 createUiDefinition.json 檔案中的 filter 屬性,則清單中會顯示指定資源類型的所有資源。

下一步