# azdevops-sci-hooks **Repository Path**: mirrors_DataDog/azdevops-sci-hooks ## Basic Information - **Project Name**: azdevops-sci-hooks - **Description**: Configuration script to setup Source Code Integration hooks on Azure DevOps - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-03 - **Last Updated**: 2026-02-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Azure DevOps service hooks setup for Source Code Integration This script is a helper to configure service hooks required by Datadog's Source Code Integration. Datadog requires the following event types: - [`git.pullrequest.created`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#git.pullrequest.created) - [`git.pullrequest.updated`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#git.pullrequest.updated) - [`git.push`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#git.push) - [`ms.vss-pipelines.run-state-changed-event`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#run-state-changed) - [`ms.vss-pipelines.stage-state-changed-event`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#run-stage-state-changed) - [`ms.vss-pipelines.job-state-changed-event`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#run-job-state-changed) - [`ms.vss-pipelinechecks-events.approval-pending`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#run-stage-waiting-for-approval) - [`ms.vss-pipelinechecks-events.approval-completed`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#run-stage-approval-completed) - [`build.complete`](https://learn.microsoft.com/en-us/azure/devops/service-hooks/events?view=azure-devops#build-completed) ## Usage 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](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows#create-a-pat) for instructions on how to generate one. ```sh # Bash export AZURE_DEVOPS_TOKEN= ``` ```powershell # Powershell $Env:AZURE_DEVOPS_TOKEN = "" ``` ### Installing the service hooks To install the service hooks on all projects in your Azure DevOps organization, you'll need: - Your Datadog site parameter ([learn more](https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site)) - 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](https://docs.datadoghq.com/account_management/api-app-keys/) to generate an API key. - Your Azure DevOps organization slug. This is the first path segment in a repository URL (e.g. `my-org` for `dev.azure.com/my-org/...`) The command will display the number of affected projects and prompt you for confirmation before proceeding. ```sh # Python script DD_API_KEY= ./setup-hooks.py --dd-site= --az-devops-org= ``` ```powershell # Powershell $Env:DD_API_KEY = "" .\setup-hooks.ps1 -DdSite -AzDevOpsOrg ``` If you only want to install the service hooks for a single project in your Azure DevOps organization, you can use the `--project` (python) or `-Project` (powershell) flag to only target this one. ### Uninstalling the service hooks The following command will uninstall the Datadog service hooks from **all projects** in your organization: ```sh # Python script ./setup-hooks.py --dd-site= --az-devops-org= --uninstall ``` ```powershell # Powershell .\setup-hooks.ps1 -DdSite -AzDevOpsOrg -Uninstall ``` ## Limitations - 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.