Azure Native Integration Programmatic Management Guide

Overview

The Azure Native integration uses the Datadog resource in Azure to streamline management and data collection for your Azure environment. Datadog recommends using this method when possible. This method involves creating the azurerm_datadog_monitor resource and assigning it the Monitoring Reader role to link your Azure subscription(s) to your Datadog organization. This replaces the App Registration credential process for metric collection and Event Hub setup for log forwarding.

Setup

Note: To set up the Azure Native integration, you must be an Owner on any Azure subscriptions you want to link, and Admin for the Datadog org you are linking them to.

Terraform

  1. Ensure that you have configured the Terraform Azure provider.

  2. Use the templates below to create the azurerm_datadog_monitor resource and perform the Monitoring Reader role assignment with Terraform:

Azure Datadog Monitor resource

resource "azurerm_resource_group" "example" {
  name     = "<NAME>"
  location = "<AZURE_REGION>"
}
resource "azurerm_datadog_monitor" "example" {
  name                = "<NAME>"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  datadog_organization {
    api_key         = "<DATADOG_API_KEY>"
    application_key = "<DATADOG_APPLICATION_KEY>"
  }
  user {
    name  = "<NAME>"
    email = "<EMAIL>"
  }
  sku_name = "Linked"
  identity {
    type = "SystemAssigned"
  }
}

Monitoring Reader role

data "azurerm_subscription" "primary" {}

data "azurerm_role_definition" "monitoring_reader" {
  name = "Monitoring Reader"
}

resource "azurerm_role_assignment" "example" {
  scope              = data.azurerm_subscription.primary.id
  role_definition_id = data.azurerm_role_definition.monitoring_reader.role_definition_id
  principal_id       = azurerm_datadog_monitor.example.identity.0.principal_id
}
  1. Run terraform apply.

Log collection

Once the Datadog resource is set up in your Azure account, configure log collection through the Azure Portal. See Configure metrics and logs in the Azure documentation for more information.

The Azure Native integration is only available for organizations on Datadog's US3 site. If you're using a different Datadog site, see the standard Azure Programmatic Management guide. If you're using the Datadog US3 site, change the site selector on the right of this page.

PREVIEWING: may/unit-testing