This script is a helper to configure service hooks required by Datadog's Source Code Integration.
Datadog requires the following event types:
This script requires either:
- a working Python 3 installation
- a working Powershell installation
This script requires an Azure DevOps Personal Access Token to query Azure DevOps APIs on your behalf. You can refer to this Microsoft documentation for instructions on how to generate one.
# Bash
export AZURE_DEVOPS_TOKEN=<secret token>
# Powershell
$Env:AZURE_DEVOPS_TOKEN = "<secret token>"
To install the service hooks on all projects in your Azure DevOps organization, you'll need:
- Your Datadog site parameter (learn more)
- A Datadog API key. This will allow authenticating the webhooks that Azure DevOps sends to Datadog on behalf of your organization. Please refer to this Datadog documentation to generate an API key.
- Your Azure DevOps organization slug. This is the first path segment in a repository URL (e.g.
my-org
fordev.azure.com/my-org/...
)
The command will display the number of affected projects and prompt you for confirmation before proceeding.
# Python script
DD_API_KEY=<api-key> ./setup-hooks.py --dd-site=<datadog-site> --az-devops-org=<organization-slug>
# Powershell
$Env:DD_API_KEY = "<api-key>"
.\setup-hooks.ps1 -DdSite <datadog-site> -AzDevOpsOrg <organization-slug>
If you only want to install the service hooks for a single project in your Azure DevOps organization, you can use the --project
flag to only target this one.
The following command will uninstall the Datadog service hooks from all projects in your organization:
# Python script
./setup-hooks.py --dd-site=<datadog-site> --az-devops-org=<organization-slug> --uninstall
# Powershell
.\setup-hooks.ps1 -DdSite <datadog-site> -AzDevOpsOrg <organization-slug> -Uninstall
- This script currently only supports installing service hooks on an Azure DevOps organization for a single Datadog organization. Configuring the same Azure DevOps organization for multiple Datadog organizations is not supported.