---
title: Azure Pipelines Setup for CI Visibility
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Continuous Integration Visibility > CI Pipeline Visibility in Datadog >
  Azure Pipelines Setup for CI Visibility
---

# Azure Pipelines Setup for CI Visibility

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site). ().
{% /alert %}

{% /callout %}

{% alert level="danger" %}
Azure DevOps Server is not officially supported.
{% /alert %}

## Overview{% #overview %}

[Azure Pipelines](https://azure.microsoft.com/en-us/products/devops/pipelines) is a continuous integration and delivery service that supports any language, platform, or cloud.

Set up CI Visibility for Azure Pipelines to gain real time insights into your CI/CD workflows, track pipeline performance, analyze inefficiencies, and manage your deployment operations.

### Compatibility{% #compatibility %}

| Pipeline Visibility                                                                                                                              | Platform                            | Definition                                                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CI jobs failure analysis](https://docs.datadoghq.com/continuous_integration/guides/use_ci_jobs_failure_analysis/)                               | CI jobs failure analysis            | Use LLM models on relevant logs to analyze the root cause of failed CI jobs.                                                                      |
| Logs correlation                                                                                                                                 | Logs correlation                    | Correlate pipeline and job spans to logs. Requires job log collection.                                                                            |
| [Custom tags](https://docs.datadoghq.com/glossary/#custom-tag) [and measures at runtime](https://docs.datadoghq.com/glossary/#custom-measure)    | Custom tags and measures at runtime | Configure [custom tags and measures](https://docs.datadoghq.com/continuous_integration/pipelines/custom_tags_and_measures/?tab=linux) at runtime. |
| [Custom spans](https://docs.datadoghq.com/glossary/#custom-span)                                                                                 | Custom spans                        | Configure custom spans for your pipelines.                                                                                                        |
| [Filter CI Jobs on the critical path](https://docs.datadoghq.com/continuous_integration/guides/identify_highest_impact_jobs_with_critical_path/) | Filter CI Jobs on the critical path | Filter by jobs on the critical path.                                                                                                              |
| [Execution time](https://docs.datadoghq.com/glossary/#pipeline-execution-time)                                                                   | Execution time                      | View the amount of time pipelines have been running jobs.                                                                                         |

### Terminology{% #terminology %}

This table shows the mapping of concepts between Datadog CI Visibility and Azure Pipelines:

| Datadog                    | Azure Pipelines |
| -------------------------- | --------------- |
| Pipeline                   | Pipeline        |
| Stage                      | Stage           |
| Job                        | Job             |
| *Not available in Datadog* | Step            |

## Configure the Datadog integration{% #configure-the-datadog-integration %}

{% tab title="Datadog Integration (recommended)" %}
### Enable CI Visibility in Datadog{% #enable-ci-visibility-in-datadog %}

After the Azure App is created and installed, enable CI Visibility for the organizations and projects you want Datadog to monitor.

1. Verify that your Azure DevOps organization is linked to a **Microsoft Entra tenant**. See the [Azure source code setup instructions](https://docs.datadoghq.com/integrations/azure-devops-source-code/#setup) for guidance on connecting Azure DevOps projects to Datadog.

1. In Datadog, navigate to [**Software Delivery → CI Visibility → Add a Pipeline Provider → Azure Pipelines**](https://app.datadoghq.com/ci/setup/pipeline?provider=azurepipelines).

1. Click **Configure** next to the Azure DevOps organization you want to enable.

1. To enable CI Visibility for the entire organization, toggle **Enable CI Visibility**. Future projects detected by the Azure app will automatically be enabled.

1. To enable CI Visibility for individual projects:

   - Scroll through the projects list.
   - Toggle **Enable CI Visibility** for each project you want to monitor.

Pipelines appear in Datadog immediately after CI Visibility is enabled for an organization or project.

{% alert level="danger" %}
If you previously configured Azure Pipelines using Service Hook Subscriptions, disable that integration before enabling CI Visibility for the same projects. Running both integrations simultaneously does not incur additional costs, but it creates duplicate data.
{% /alert %}

{% /tab %}

{% tab title="Service Hook Subscriptions" %}
The Datadog integration for [Azure Pipelines](https://docs.datadoghq.com/integrations/azure_devops/) works by using [service hooks](https://learn.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops) to send data to Datadog.

1. Install the [Datadog CI Visibility](https://marketplace.visualstudio.com/items?itemName=Datadog.ci-visibility) extension from the Azure Marketplace. There are several extensions starting with **Datadog**, make sure that you are installing the [Datadog CI Visibility](https://marketplace.visualstudio.com/items?itemName=Datadog.ci-visibility) extension.

1. For each project, go to **Project settings > Service hooks** in Azure DevOps and select the green plus (+) icon to create a subscription.

1. Create a subscription to the `Datadog CI Visibility` service for each of the following webhook types. These event types are required and must be enabled individually.

   - **Run state changed**
   - **Run stage state changed**
   - **Run job state changed**
   - **Run stage approval completed**
   - **Run stage waiting for approval**
   - **Build completed**

1. Click **Next** to continue to the next step and set the following:

   - **Datadog Site**: `<span class="js-region-param region-param" data-region-param="dd_site"></span>`
   - **Datadog API Key**: Your [Datadog API key](https://app.datadoghq.com/organization-settings/api-keys).

1. Click **Finish**.

### Configuring multiple projects in bulk{% #configuring-multiple-projects-in-bulk %}

Datadog offers a [script](https://raw.githubusercontent.com/DataDog/ci-visibility-azure-pipelines/main/service_hooks.py) to help you enable service hooks across multiple or all of your Azure projects using the Azure API. The script requires Python 3 and the `requests` package.

To run the script, you need:

- An Azure DevOps username
- An Azure DevOps [API token](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows#create-a-pat)
- An Azure DevOps organization name

The script supports environment variables `DD_API_KEY` and `DD_SITE`, and flags parameters `--dd-api-key` and `--dd-site`.

For more information, you can run the following command:

```shell
./service_hooks.py --help
```

#### All Azure projects{% #all-azure-projects %}

Example for enabling the hooks in all projects:

```shell
./service_hooks.py \
    --dd-api-key ******************** \
    --az-user "John Doe" \
    --az-token ********************** \
    --az-org datadoghq \
    --threads 4
```

#### Specific Azure projects{% #specific-azure-projects %}

Example for enabling the hooks in specified projects:

```shell
./service_hooks.py \
    --dd-api-key ******************** \
    --az-user "John Doe" \
    --az-token ********************** \
    --az-org datadoghq \
    projectName1 projectName2
```

{% /tab %}

## Advanced configuration{% #advanced-configuration %}

### Set custom tags{% #set-custom-tags %}

You can set custom tags for all pipeline and job spans from your Azure projects to improve traceability. For more information, see [Custom Tags and Measures](https://docs.datadoghq.com/continuous_integration/pipelines/custom_tags_and_measures/?tab=linux).

### Collect job logs{% #collect-job-logs %}

To enable log collection for Azure DevOps pipelines:

1. Set up the Datadog Azure DevOps integration by following the steps in the [Azure integration tile](https://app.datadoghq.com/integrations/azure).

1. In Datadog, go to [CI Visibility Settings](https://app.datadoghq.com/ci/settings/visibility/azure-devops).

1. Enable log pulling for Azure DevOps.

Logs are billed separately from CI Visibility. Log retention, exclusion, and indexes are configured in [Log Management](https://docs.datadoghq.com/logs/guide/best-practices-for-log-management/). Logs for Azure jobs can be identified by the `datadog.product:cipipeline` and `source:azurepipelines` tags.

### CI jobs failure analysis{% #ci-jobs-failure-analysis %}

If job logs collection is enabled, CI Visibility uses LLM models to compute the analysis for failed CI jobs based on relevant logs coming from Azure Pipelines.

You can also add job failure analysis to a PR comment. See the guide on [using PR comments](https://docs.datadoghq.com/continuous_integration/guides/use_ci_jobs_failure_analysis/#using-pr-comments).

For a full explanation, see the guide on [using CI jobs failure analysis](https://docs.datadoghq.com/continuous_integration/guides/use_ci_jobs_failure_analysis/).

## Visualize pipeline data in Datadog{% #visualize-pipeline-data-in-datadog %}

The [**CI Pipeline List**](https://app.datadoghq.com/ci/pipelines) and [**Executions**](https://app.datadoghq.com/ci/pipeline-executions) pages populate with data after the workflows finish.

The **CI Pipeline List** page shows data for only the default branch of each repository. For more information, see [Search and Manage CI Pipelines](https://docs.datadoghq.com/continuous_integration/search/#search-for-pipelines).

## Further reading{% #further-reading %}

- [Monitor Azure Pipelines with Datadog CI Visibility](https://www.datadoghq.com/blog/azure-pipelines-ci-visibility/)
- [Troubleshooting CI Visibility](https://docs.datadoghq.com/continuous_integration/troubleshooting/)
- [Extend Pipeline Visibility by adding custom tags and measures](https://docs.datadoghq.com/continuous_integration/pipelines/custom_tags_and_measures/)
