---
title: Azure DevOps
description: |-
  Azure DevOps is a set of modern development services for planning,
      collaborating, and building.
breadcrumbs: Docs > Integrations > Azure DevOps
---

# Azure DevOps
Integration version1.0.0Azure DevOps Overview Dashboard
## Overview{% #overview %}

[Azure DevOps](https://learn.microsoft.com/en-us/azure/devops/user-guide/what-is-azure-devops?toc=%2Fazure%2Fdevops%2Fget-started%2Ftoc.json&view=azure-devops) provides features that organizations use to create and develop products faster. Integrate Datadog with Azure DevOps to:

- Track pull requests and merges to your various projects.
- Monitor release and build events in context with other data from your stack.
- Track durations of completed builds and work items.
- Keep track of work items and updates.

## Setup{% #setup %}

### Installation{% #installation %}

In Datadog, click the install button in the [Azure DevOps integration tile](https://app.datadoghq.com/integrations/azuredevops).

### Configuration{% #configuration %}

Use a service hook to create events and metrics in Datadog in response to events from Azure DevOps services:

1. In Azure, go to your project's service hooks page.
1. Click **Create subscription**.
1. Pick the Datadog service.
1. Configure the triggering Visual Studio event.
1. Enter your [Datadog API key](https://app.datadoghq.com/organization-settings/api-keys) into the required field.
1. Add your Datadog organization site:
1. Test the service hook subscription and finish the wizard. **Note**: The test does not validate your API key or Datadog organization site.
1. Repeat steps 4-7 for each event type you want to send to Datadog. All event types are accepted.

After your service hooks are configured, go to Datadog to see events and metrics from Azure DevOps.

Additional reference from Azure: [Create a service hook for Azure DevOps Services and TFS with Datadog](https://docs.microsoft.com/en-us/azure/devops/service-hooks/services/datadog?view=azure-devops)

#### Programmatic{% #programmatic %}

Follow Azure's documentation to [Create a service hooks subscription programmatically](https://docs.microsoft.com/en-us/azure/devops/service-hooks/create-subscription?view=azure-devops) and use Datadog's endpoint:

```text
https:///intake/webhook/azuredevops?api_key=<DATADOG_API_KEY>
```

#### Generic Web Hooks{% #generic-web-hooks %}

You can use a generic Web Hook for more control over the payload that Azure will send to Datadog.

1. In Azure, go to your project's service hooks page.
1. Click **Create subscription**.
1. Pick the Web Hook service.
1. Configure the triggering Visual Studio event.
1. Enter your Datadog URL and [Datadog API key](https://app.datadoghq.com/organization-settings/api-keys) into the URL field, for example, https:///intake/webhook/azuredevops?api_key=<DATADOG_API_KEY>.
1. Set Resource Version to **Latest**, or to the version you need. Datadog recommends using **Latest** or the most recent Resource Version.
1. Test the service hook subscription and finish the wizard. **Note**: The test does not validate your API key or Datadog organization site.

### Use Datadog monitors as gates in Azure pipelines{% #use-datadog-monitors-as-gates-in-azure-pipelines %}

You can also use Datadog monitors as gates to [control release deployments](https://docs.microsoft.com/en-us/azure/devops/pipelines/release/approvals/gates?view=azure-devops) in Azure Pipelines. This option allows you to automatically stop problematic deployments if an unhealthy state is detected in Datadog.

1. Add the [Datadog Monitors as Deployment Gates](https://marketplace.visualstudio.com/items?itemName=Datadog.datadog-monitors) extension to your Azure DevOps org.

1. In Azure DevOps, go to **Service Connections** under your project settings and select **New Service Connection**.

1. Select Datadog from the list and press **Next**.

1. In the fields provided, add your Datadog API key and application key for the account you want to use, then enter a name and description to identify this Datadog account in Azure DevOps. Click **Save**. You can add additional service connections if you need to query monitors from multiple Datadog accounts.

1. Go to **Azure Pipelines** to configure your deployment. Here, there's an option to add pre or post deployment conditions between stages. Select where you want to add a Datadog monitor, and then enable the toggle switch for **Gates**.

1. Click **Add** and select the option **Query Datadog monitors**.

1. Select the Datadog service connection then enter your monitor ID and the severity threshold you want to use. The severity threshold is the state of the monitor (either `Alert` or `Warning`) at which the task is failed.

1. Repeat steps 5-7 to add additional gates as needed in your deployment pipeline.

**Note**: Use [composite monitors](https://app.datadoghq.com/monitors/monitor_types/composite/) to monitor multiple conditions for the gates in your pipeline as part of a single health state for each stage.

To view the source code, see the [Azure Devops Monitor Gate Extension repo](https://github.com/DataDog/azure-devops-monitor-gate-extension)."

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **azure.devops.event.count**(counter)       | The total number of events.*Shown as event*          |
| **azure.devops.build.duration**(gauge)      | The duration of a build.*Shown as second*            |
| **azure.devops.release.duration**(gauge)    | The duration of a release.*Shown as second*          |
| **azure.devops.work\_item.duration**(gauge) | The lifetime duration of a work item.*Shown as hour* |

### Events{% #events %}

The Azure DevOps integration supports the following [service hook event types](https://docs.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#available-event-types):

- Build and release

  - Build Complete
  - Release Created
  - Release Abandoned
  - Deployment Approval Completed
  - Deployment Approval Pending
  - Deployment Completed
  - Deployment Started

- Code

  - Code Checked-In
  - Code Pushed
  - Pullrequest Created
  - Pullrequest Merged
  - Pullrequest Updated
  - Pullrequest Commented on

- Work items

  - Workitem Created
  - Workitem Updated
  - Workitem Deleted
  - Workitem Restored
  - Workitem Commented

- Pipeline

  - Run State Changed
  - Job State Changed
  - Run Stage State Changed
  - Run Stage Approval Pending
  - Run Stage Approval Completed

- Service Connections

  - Service Connection Created
  - Service Connection Updated

If there's an Azure DevOps event type not listed above that you would like to track, please contact [Datadog support](https://docs.datadoghq.com/help/).

### Service Checks{% #service-checks %}

The Azure DevOps integration does not include any service checks.

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).

### FAQ{% #faq %}

#### Is there an additional cost for this integration?{% #is-there-an-additional-cost-for-this-integration %}

The metrics and events generated from this integration do not incur any additional costs.

#### How long does this data persist in Datadog?{% #how-long-does-this-data-persist-in-datadog %}

The data from this integration is held for 15 months, similar to other types of timeseries data in Datadog.

#### How long does it take for the events and metrics to display in Datadog?{% #how-long-does-it-take-for-the-events-and-metrics-to-display-in-datadog %}

The total latency has many variables, but in most cases the events and metrics display in Datadog within 30 seconds of the incident occurring.

#### What can you do with the Azure DevOps events and metrics in Datadog?{% #what-can-you-do-with-the-azure-devops-events-and-metrics-in-datadog %}

The events and metrics can be used like other events and metrics in Datadog, including building dashboards, setting up monitors, and troubleshooting.

#### How are the metrics for build duration and work item duration generated?{% #how-are-the-metrics-for-build-duration-and-work-item-duration-generated %}

The build duration is generated from *build completed* events by taking the time difference between when the build was initiated to when it completed (measured in seconds).

The work item duration is generated from *work item updated* events by taking the time difference between the transition to `Done` and when the work item was created (measured in hours).

**Note**: If a `Done` work item is re-opened, the next time it is transitioned to `Done` another data point is generated. The initial data point is not modified, and the new data point still measures from the time the work item was initially created.

#### Your service hook subscription test returns a success message, why aren't events arriving to Datadog?{% #your-service-hook-subscription-test-returns-a-success-message-why-arent-events-arriving-to-datadog %}

The service hook subscription test only checks whether Azure DevOps is able to send events to Datadog. It does not validate your API key or your Datadog organization site (US or EU). Make sure that the API key and site are correct.

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

- [Monitor Azure Pipelines with Datadog CI Visibility](https://www.datadoghq.com/blog/azure-pipelines-ci-visibility/)
- [Run Datadog Synthetic tests in Azure Pipelines](https://www.datadoghq.com/blog/azure-pipeline-testing-with-datadog-synthetic-monitoring/)
- [Monitor Azure DevOps workflows and pipelines with Datadog](https://www.datadoghq.com/blog/monitor-azure-devops/)
