Data collection rule should have data flows configured

High Azure General datacollectionrules-data-collection-rule-data

Applies to

  • Microsoft.Insights/dataCollectionRules

What CGPulse checks

A resource passes this rule when dataFlowsCount must be one of [1,2,3,4,5,6,7,8,9,10]. Anything else is reported as a finding with the evaluated property value attached as evidence.

How to fix it

Configure at least one data flow to route collected data to monitoring destinations. In Azure Portal: Monitor > Data Collection Rules > select rule > add data flow. See: https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/data-collection-rule-overview

CLI

az monitor data-collection rule show --ids "{id}" --query "dataFlows" -o table

Bicep

resource dcr 'Microsoft.Insights/dataCollectionRules@2023-03-11' = {{
  name: '{name}'
  location: resourceGroup().location
  properties: {{
    dataSources: {{
      performanceCounters: [
        {{
          name: 'perfCounters'
          streams: ['Microsoft-Perf']
          samplingFrequencyInSeconds: 60
          counterSpecifiers: ['\\Processor(_Total)\\% Processor Time']
        }}
      ]
    }}
    destinations: {{
      logAnalytics: [
        {{
          workspaceResourceId: '<workspace-id>'
          name: 'logAnalytics'
        }}
      ]
    }}
    dataFlows: [
      {{
        streams: ['Microsoft-Perf']
        destinations: ['logAnalytics']
      }}
    ]
  }}
}}

Terraform

resource "azurerm_monitor_data_collection_rule" "{name}" {
  name                = "{name}"
  resource_group_name = "{rg}"
  location            = var.location
  data_flow {
    streams      = ["Microsoft-Perf"]
    destinations = ["log-analytics"]
  }
  destinations {
    log_analytics {
      workspace_resource_id = "<workspace-id>"
      name                  = "log-analytics"
    }
  }
  data_sources {
    performance_counter {
      streams                       = ["Microsoft-Perf"]
      sampling_frequency_in_seconds = 60
      counter_specifiers            = ["\\Processor(_Total)\\% Processor Time"]
      name                          = "perfCounters"
    }
  }
}

Compliance frameworks

Is your environment compliant with this rule?

CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.

Run a free scan

Related Azure rules

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.