Skip to content
Latchkey

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

Run this faster and cheaper on Latchkey managed runners. Start free →