You should be able to utilize Microsoft.Solutions.ResourceSelector UI element to accomplish this. The ResourceSelector
user-interface (UI) element lets users select an existing Azure resource from a subscription. You specify the resource provider namespace and resource type, like Microsoft.Storage/storageAccounts
in the element's JSON. You can use the element to filter the list by subscription or location. From the element's UI, to search within the list's contents, you can type a filter like resource group name, resource name, or a partial name.
The sample on this page has references for how to do this with vnet and subnet. Relevant code pasted from uiFormDefinition.json
{
"name": "networkSettings",
"label": "Network Settings",
"elements": [
{
"name": "vnetSelector",
"type": "Microsoft.Solutions.ResourceSelector",
"label": "Virtual Network",
"resourceType": "Microsoft.Network/virtualNetworks",
"options": {
"filter": {
"subscription": "onBasics",
"location": "onBasics"
}
}
},
{
"name": "subnets",
"type": "Microsoft.Solutions.ArmApiControl",
"request": {
"method": "GET",
"path": "[concat(steps('basics').resourceScope.subscription.id, '/resourceGroups/', last(take(split(steps('networkSettings').vnetSelector.id, '/'), 5)), '/providers/Microsoft.Network/virtualNetworks/', steps('networkSettings').vnetSelector.name,'/subnets?api-version=2022-01-01')]"
}
},
{
"name": "subnetList",
"type": "Microsoft.Common.DropDown",
"label": "Subnet",
"filter": true,
"constraints": {
"allowedValues": "[map(steps('networkSettings').subnets.value, (item) => parse(concat('{\"label\":\"', item.name, '\",\"value\":\"', item.id, '\"}')))]",
"required": true
},
"visible": true
},
Let me know if this helps. Feel free to share the template and I will be happy to test this and see if I can get the drop-down selection working.
If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.
If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.
Thank you for helping to improve Microsoft Q&A!