How to Gate Prod With a Manual Validation in Azure Pipelines
ManualValidation@0 in an agentless job pauses the pipeline and waits for a named user to approve or reject.
Add a server (agentless) job before the deploy with ManualValidation@0. The run pauses, notifies the listed users, and resumes only on approval.
Steps
- Add a stage with
pool: server(agentless) before the deploy. - Use
ManualValidation@0withnotifyUsersand aninstructionsmessage. - Make the deploy stage
dependsOnthe validation stage.
azure-pipelines.yml
azure-pipelines.yml
stages:
- stage: Approve
jobs:
- job: WaitForApproval
pool: server
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440
inputs:
notifyUsers: 'release@example.com'
instructions: 'Approve to deploy to production.'
onTimeout: 'reject'
- stage: DeployProd
dependsOn: Approve
jobs:
- deployment: Prod
environment: production
strategy: { runOnce: { deploy: { steps: [ { script: ./deploy.sh prod } ] } } }Gotchas
- ManualValidation only runs in an agentless (
pool: server) job, not a normal job. - Set
timeoutInMinutesandonTimeoutso a forgotten approval does not hang the run forever.
Related guides
How to Deploy With a Deployment Job and Environment Approval in Azure PipelinesRun a deployment job against a pipeline environment in Azure Pipelines so an approval check on that environme…
How to Deploy Across Dev, Staging, and Prod Stages in Azure PipelinesPromote a build through dev, staging, and prod stages in Azure Pipelines by chaining stages with dependsOn so…