Menu

Caution

Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source

azure_exporter_config

Overview

The azure_exporter_config block configures the azure_exporter integration, an embedded version of azure-metrics-exporter, used to collect metrics from Azure Monitor. The exporter uses Azure Resource Graph queries to identify resources for gathering metrics.

List of Supported Services and Metrics

The exporter supports all metrics defined by Azure Monitor. The complete list of available metrics can be found in the Azure Monitor documentation. Metrics for this integration are exposed with the template azure_{type}_{metric}_{aggregation}_{unit}. As an example, the Egress metric for BlobService would be exported as azure_microsoft_storage_storageaccounts_blobservices_egress_total_bytes.

Authentication

The agent must be running in an environment with access to Azure. The exporter uses the Azure SDK for go and supports authentication via https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authentication?tabs=bash#2-authenticate-with-azure.

The account used by Grafana Agent needs:

Configuration

Config Reference

yaml
  #
  # Common Integration Settings
  #

  # Enables the azure_exporter integration, allowing the Agent to automatically collect metrics or expose azure metrics
  [enabled: <boolean> | default = false]

  # Sets an explicit value for the instance label when the integration is self-scraped. Default will be
  # based on subscriptions and ResourceType being monitored
  [instance: <string>]

  # Automatically collect metrics from this integration. If disabled, the exporter integration will be run but not
  # scraped and thus not. remote-written. Metrics for the integration will be exposed at
  # /integrations/azure_exporter/metrics and can be scraped by an external process.
  [scrape_integration: <boolean> | default = <integrations_config.scrape_integrations>]

  # How often should the metrics be collected? Defaults to
  # prometheus.global.scrape_interval.
  [scrape_interval: <duration> | default = <global_config.scrape_interval>]

  # The timeout before considering the scrape a failure. Defaults to
  # prometheus.global.scrape_timeout.
  [scrape_timeout: <duration> | default = <global_config.scrape_timeout>]

  # Allows for relabeling labels on the target.
  relabel_configs:
    [- <relabel_config> ... ]

  # Relabel metrics coming from the integration, allowing to drop series
  # from the integration that you don't care about.
  metric_relabel_configs:
    [ - <relabel_config> ... ]

  # How frequent to truncate the WAL for this integration.
  [wal_truncate_frequency: <duration> | default = "60m"]

  #
  # Exporter specific configuration
  #

  # Required: The azure subscription(s) to scrape metrics from
  subscriptions:
    [ - <string> ... ]

  # Required: The Azure Resource Type to scrape metrics for
  # Valid values can be found as the heading names on this page https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported
  # Ex: Microsoft.Cache/redis
  [resource_type: <string>]

  # Required: The metrics to scrape from resources
  # Valid values can be found in the `Metric` column for the`resource_type` https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported
  # Example:
  #   resource_type: Microsoft.Cache/redis
  #   metrics:
  #     - allcachehits
  metrics:
    [ - <string> ... ]

  # Optional: The [kusto query](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/) filter to apply when searching for resources
  # This value will be embedded in to a template query of the form `Resources | where type =~ "<resource_type>" <resource_graph_query_filter> | project id, tags`
  [resource_graph_query_filter: <string>]

  # Optional: Aggregation to apply for the metrics produced. Valid values are minimum, maximum, average, total, and count
  # If no aggregation is specified the value for `Aggregation Type` on the `Metric` is used from https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported
  metric_aggregations:
    [ - <string> ... ]

  # Optional: An [ISO8601 Duration](https://en.wikipedia.org/wiki/ISO_8601#Durations) used when querying the metric value
  [timespan: <string> | default = "PT1M"]

  # Optional: Used to include `Dimensions` available to a `Metric` definition https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported
  # These will appear as labels on the metrics,
  #   If a single dimension is requested it will have the name `dimension`
  #   If multiple dimensions are requested they will have the name `dimension<dimension_name>`
  # Example:
  #   resource_type: Microsoft.Cache/redis
  #   metrics:
  #     - allcachehits
  #   included_dimensions:
  #     - ShardId
  #     - Port
  #     - Primary
  included_dimensions:
    [ - <string> ... ]

  # Optional: A list of resource tags to include on the final metrics
  # These are added as labels with the name `tag_<tag_name>`
  included_resource_tags:
    [ - <string> ... ]

  # Optional: used for ResourceTypes which have multiple levels of metrics
  # Example: the resource_type Microsoft.Storage/storageAccounts has metrics for
  #   Microsoft.Storage/storageAccounts (generic metrics which apply to all storage accounts)
  #   Microsoft.Storage/storageAccounts/blobServices (generic metrics + metrics which only apply to blob stores)
  #   Microsoft.Storage/storageAccounts/fileServices (generic metrics + metrics which only apply to file stores)
  #   Microsoft.Storage/storageAccounts/queueServices (generic metrics + metrics which only apply to queue stores)
  #   Microsoft.Storage/storageAccounts/tableServices (generic metrics + metrics which only apply to table stores)
  # If you want blob store metrics you will need to set
  #   resource_type: Microsoft.Storage/storageAccounts
  #   metric_namespace = Microsoft.Storage/storageAccounts/blobServices
  [metric_namespace: <string>]

  # Optional: Which azure cloud environment to connect to, azurecloud, azurechinacloud, azuregovernmentcloud, or azurepprivatecloud
  [azure_cloud_environment: <string> | default = "azurecloud"]

Examples

Azure Kubernetes Service Node Metrics

yaml
  azure_exporter:
    enabled: true
    scrape_interval: 60s
    subscriptions:
      - <subscription_id>
    resource_type: microsoft.containerservice/managedclusters
    metrics:
      - node_cpu_usage_millicores
      - node_cpu_usage_percentage
      - node_disk_usage_bytes
      - node_disk_usage_percentage
      - node_memory_rss_bytes
      - node_memory_rss_percentage
      - node_memory_working_set_bytes
      - node_memory_working_set_percentage
      - node_network_in_bytes
      - node_network_out_bytes
    included_resource_tags:
      - environment
    included_dimensions:
      - node
      - nodepool

Blob Storage Metrics

yaml
  azure_exporter:
    enabled: true
    scrape_interval: 60s
    subscriptions:
      - <subscription_id>
    resource_type: Microsoft.Storage/storageAccounts
    metric_namespace: Microsoft.Storage/storageAccounts/blobServices
    metrics:
      - Availability
      - BlobCapacity
      - BlobCount
      - ContainerCount
      - Egress
      - IndexCapacity
      - Ingress
      - SuccessE2ELatency
      - SuccessServerLatency
      - Transactions
    timespan: PT1H
    resource_graph_query_filter: where location == "westeurope"

Multiple Azure Services in a single config

The Azure Metrics API has rather strict limitations on the number of parameters which can be supplied. Due to this, you cannot gather metrics from multiple resource_types in the same azure_exporter instance. If you need metrics from multiple resources, you can enable integration-next or configure Agent to expose the exporter via the azure_exporter config with data configured through metrics scrape_configs. The following example configuration combines the two examples above in a single Agent configuration.

Note: This is not a complete configuration; blocks have been removed for simplicity.

yaml
integrations:
  azure_exporter:
    enabled: true
    scrape_integration: false
    azure_cloud_environment: azurecloud

metrics:
  configs:
    - name: integrations
      scrape_configs:
        - job_name: azure-blob-storage
          scrape_interval: 1m
          scrape_timeout: 50s
          static_configs:
            - targets: ["localhost:12345"]
          metrics_path: /integrations/azure_exporter/metrics
          params:
            subscriptions:
              - 179c4f30-ebd8-489e-92bc-fb64588dadb3
            resource_type: ["Microsoft.Storage/storageAccounts"]
            metric_namespace: ["Microsoft.Storage/storageAccounts/blobServices"]
            metrics:
              - Availability
              - BlobCapacity
              - BlobCount
              - ContainerCount
              - Egress
              - IndexCapacity
              - Ingress
              - SuccessE2ELatency
              - SuccessServerLatency
              - Transactions
            timespan: ["PT1H"]
            resource_graph_query_filter: ["where location == 'westeurope'"]
        - job_name: azure-kubernetes-node
          scrape_interval: 1m
          scrape_timeout: 50s
          static_configs:
            - targets: ["localhost:12345"]
          metrics_path: /integrations/azure_exporter/metrics
          params:
            subscriptions:
              - 179c4f30-ebd8-489e-92bc-fb64588dadb3
            resource_type: ["microsoft.containerservice/managedclusters"]
            resource_graph_query_filter: [" where location == 'westeurope'"]
            metrics:
              - node_cpu_usage_millicores
              - node_cpu_usage_percentage
              - node_disk_usage_bytes
              - node_disk_usage_percentage
              - node_memory_rss_bytes
              - node_memory_rss_percentage
              - node_memory_working_set_bytes
              - node_memory_working_set_percentage
              - node_network_in_bytes
              - node_network_out_bytes
            included_resource_tags:
              - environment
            included_dimensions:
              - node
              - nodepool

In this example, all azure_exporter-specific configuration settings have been moved to the scrape_config. This method supports all available configuration options except azure_cloud_environment, which must be configured on the azure_exporter. For this method, if a field supports a singular value like resource_graph_query_filter, you must be put it into an array, for example, resource_graph_query_filter: ["where location == 'westeurope'"].