I have an azure runbook that has some Python code. And this runbook needs to be triggered as soon as an azure pipeline runs successfully. Note: I cannot make changes to the pipeline steps or the pipeline. This should be done via configurations or some workarounds.
Our customers have 100s of pipelines/pipeline jobs, so changing the pipelines to ‘add’ one more step to trigger the webhook is not feasible.
2
Answers
This could be achieved through the webhooks functionality natively offered by Azure DevOps, see: Webhooks with Azure DevOps – Azure DevOps | Microsoft Learn.
If the pipelines are YAML pipelines or classic build pipelines then you’ll want to select the Build completed event type.
simon-pearson’s method is correct.
We can use the Webhook in Azure DevOps Project Settings -> Service Hooks -> Webhook to run the Post method to trigger the Azure Runbook.
I would like to share more detailed steps about complete the process:
Step1: Create the Webhook in Azure Runbook. We can record the Webhook URL.
Step2: Navigate to Azure DevOps Project Settings -> Service Hooks -> Webhook. Then we can select the Trigger event: Build completed and patse the webhook URL to the URL Field.
Result:
When the Pipeline runs complete, it will trigger the service hook and trigger the Azure RunBook via the webhook.
Azure DevOps:
Azure Runbook job: