@LXF Girish is on leave so I wanted to step in and assist.
To retrieve and display the Immutable ID of a Data Collection Rule (DCR) in the Azure portal UI, you need to extract the Immutable ID from the response of your getDCR
API call and then use it in your dropdown or other UI elements.
- Extract Immutable ID in
getDCR
API call: Make sure yourgetDCR
API call retrieves the necessary details including the Immutable ID. The response of this API call should include the Immutable ID. - Modify the Dropdown to Display Immutable ID: You need to update the
allowedValues
of the dropdown to include the Immutable ID in the value or label. Here is an example of how you can achieve this:
{
"name": "getDCR",
"type": "Microsoft.Solutions.ArmApiControl",
"toolTip": "This filters by Data Collection Rule IDs that exist in the Resource Group selected",
"condition": "[greater(length(resourceGroup().name),0)]",
"request": {
"method": "GET",
"path": "[concat(subscription().id,'/providers/Microsoft.Insights/dataCollectionRules?api-version=2023-03-11')]"
}
},
{
"name": "immutableDCR",
"type": "Microsoft.Common.DropDown",
"label": "DCR",
"placeholder": "Select a DCR",
"toolTip": "This dropdown will list the immutable Data Collection Rule IDs that exists in the Resource Group selected",
"constraints": {
"allowedValues": "[map(filter(basics('getDCR').value, (filter) => contains(toLower(filter.id), toLower(resourceGroup().name))), (item) => parse(concat('{\"label\":\"', item.name, '\",\"value\":\"', item.properties.immutableId, '\"}')))]",
"required": true
},
"visible": true
}