How to Gate Production With Manual Approval in Azure Pipelines
A deployment job that targets an environment with an Approvals check pauses in a pending state until a named reviewer approves the release.
Add an Approvals check to the production environment in the Azure DevOps UI, then point a deployment job at that environment. The run halts before the deploy steps until someone approves.
Steps
- Add an Approvals check on the production environment and list reviewers.
- Use a deployment job that sets
environment: production. - The run pauses for approval before the deploy steps run.
Pipeline
azure-pipelines.yml
stages:
- stage: deployProd
jobs:
- deployment: release
environment: production
strategy:
runOnce:
deploy:
steps:
- script: ./deploy.sh
# The "production" environment has an Approvals check
# requiring a reviewer to approve before deploy runs.Gotchas
- The approval gate lives on the environment, so it applies to every pipeline that targets it.
- A reviewer cannot approve their own run when "requestor cannot approve" is enabled.
- Pending approvals can time out and fail the run if not actioned in the configured window.
Related guides
How to Add Approvals and Checks to an Environment in Azure PipelinesProtect an Azure Pipelines environment with approvals and checks so any deployment job targeting it pauses un…
How to Use a Deployment Job With an Environment in Azure PipelinesTrack and gate releases in Azure Pipelines with a deployment job that targets a named environment, recording…