How to retrieve a DCR Immutable Id from createUiDefinition

LXF 225 Reputation points
2024-10-29T08:17:55.2266667+00:00

Hi Community,

I am testing UX for Sentinel Solution on https://portal.azure.com/#blade/Microsoft_Azure_CreateUIDef/SandboxBlade

I am wondering after obtaining the Resource Group, workspace, and Data Collection Rule, I would like to further retrieve the Immutable ID as one of the DCR's properties. How should I construct the request path for this? Thank yyou!

"basics": [
      {
        "name": "getLAWorkspace",
        "type": "Microsoft.Solutions.ArmApiControl",
        "toolTip": "This filters by workspaces that exist in the Resource Group selected",
        "condition": "[greater(length(resourceGroup().name),0)]",
        "request": {
          "method": "GET",
          "path": "[concat(subscription().id,'/providers/Microsoft.OperationalInsights/workspaces?api-version=2020-08-01')]"
        }
      },
      {
        "name": "workspace",
        "type": "Microsoft.Common.DropDown",
        "label": "Workspace",
        "placeholder": "Select a workspace",
        "toolTip": "This dropdown will list only workspace that exists in the Resource Group selected",
        "constraints": {
          "allowedValues": "[map(filter(basics('getLAWorkspace').value, (filter) => contains(toLower(filter.id), toLower(resourceGroup().name))), (item) => parse(concat('{\"label\":\"', item.name, '\",\"value\":\"', item.name, '\"}')))]",
          "required": true
        },
        "visible": true
      },
	  {
        "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": "immutable DCR",
        "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.name, '\"}')))]",
          "required": true
        },
        "visible": true
      }
Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,653 questions
Microsoft Security | Microsoft Sentinel
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 17,731 Reputation points Microsoft Employee Moderator
    2024-11-02T06:31:11.8566667+00:00

    @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.

    1. Extract Immutable ID in getDCR API call: Make sure your getDCR API call retrieves the necessary details including the Immutable ID. The response of this API call should include the Immutable ID.
    2. 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
    }
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.