Skip to content
Latchkey

How to Add Environment Approvals and Gates in Azure Pipelines

Azure environments add approval checks and automated gates that a deployment job must clear before it runs.

Target an environment: from a deployment job. Configure approvals and gates on that environment in the UI; the job pauses until checks pass.

A deployment job targeting an environment

The environment "production" can carry a required-approvers check configured in Pipelines > Environments.

azure-pipelines.yml
stages:
  - stage: Deploy
    jobs:
      - deployment: DeployProd
        environment: production
        strategy:
          runOnce:
            deploy:
              steps:
                - script: ./deploy.sh production

Gotchas

  • Approvals and gates are configured on the environment in the UI, not in YAML - the YAML only references the environment.
  • A deployment job (not a plain job) is required to bind to an environment and trigger its checks.
  • Gates can poll external systems (e.g. a monitoring query) and delay until healthy.

Related guides

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