Skip to main content
Cloud DevOps Solutions
Get a quote Talk to an engineer

Azure DevOps

Deployment Environments and Approval Gates in Azure DevOps

Azure DevOps environments represent deployment targets such as dev, staging and production. Approvals and checks attached to an environment pause a pipeline until conditions are met, for example a named approver, a protected branch, a passing health query or an exclusive lock. We design them so production is controlled without slowing every release.

Key takeaways

  • Approvals and checks belong on the environment, so they apply to every pipeline that deploys there.
  • Gates should match risk: automated checks for staging, human approval and branch control for production.
  • Branch control and required templates stop an unreviewed pipeline from reaching production.
  • Exclusive locks prevent two deployments racing into the same environment.
  • Approval fatigue is a real failure mode, so we keep human gates few and meaningful.

Why release control matters

Most teams start with the same arrangement: anyone with access can run the production pipeline. It works until a half-reviewed branch is deployed on a Friday, or two pipelines push to the same environment within minutes of each other. The usual overreaction is a change advisory board and a spreadsheet, which slows every release without catching more problems.

Environments with approvals and checks are the middle path. They put the control on the deployment target, enforce it automatically and leave a record of who allowed what. This page covers how we set them up as part of our Azure DevOps consulting, building on the pipeline structure from multi-stage YAML design.

What good looks like

  • Production can be reached only from a protected branch, through an approved pipeline.
  • Lower environments deploy automatically after tests pass.
  • Human approval is reserved for steps where judgement is needed.
  • Only one deployment runs against an environment at a time.
  • Every approval, rejection and timeout is recorded and attributable.
  • There is a documented route for urgent fixes.

How it works in practice

Environments are targets, not stages

An environment is created once and referenced by name. Pipelines deploy to it using a deployment job, which is what lets Azure DevOps attach history and checks:

stages:
  - stage: DeployProd
    dependsOn: DeployStaging
    jobs:
      - deployment: web
        environment: shop-production
        strategy:
          runOnce:
            deploy:
              steps:
                - script: ./deploy.sh production
                  displayName: Deploy

Nothing in this YAML mentions an approval. That is deliberate. The approver list, branch rules and locks live on the shop-production environment, where a contributor editing a pipeline file cannot remove them. For Kubernetes targets, an environment can map to a namespace, as described in our page on AKS deployments.

The checks we use most

CheckWhat it doesTypical place
ApprovalsNamed people or groups must approveProduction
Branch controlOnly listed branches may deployStaging and production
Required templatePipeline must extend an approved templateProduction
Exclusive lockOne run at a time, others queue or cancelAll shared environments
Business hoursDeployments only inside a windowProduction, if the business wants it
Invoke Azure Function or REST APICalls a service that returns pass or failHealth or change-ticket validation
Query Azure Monitor alertsBlocks if alerts are firingProduction

Checks run together, and all must pass. They can be combined with the repository controls in branch policies and pull request governance: branch policies decide what reaches main, and environment checks decide what leaves it.

Approvals that people actually read

A good approval request tells the approver what is changing: the build, the linked work items, the diff summary and the test results. We configure the pipeline to surface those links and keep the approver group small but with enough members that holidays do not block releases. Instructions can be added to the check so the approver knows what to verify. We also set a timeout so a forgotten request fails instead of hanging for weeks.

Separation of duties

For regulated teams, the approval check can prevent the person who triggered the run from approving it. Combined with required branch review, this means no single person can write, merge and release code alone. We turn this on where the audit requirement exists and leave it off for small teams where it would only create queues.

Deployment strategies and rollback

Deployment jobs support runOnce, rolling and canary strategies, with lifecycle hooks such as preDeploy, routeTraffic and on: failure. A rollback step in the failure hook means a failed health check can restore the previous version without waiting for a person. See the blue-green deployment glossary entry for a related pattern.

A worked example

Consider a team with three environments: shop-dev, shop-staging and shop-production. Dev has no checks, so every merge to main deploys at once. Staging has branch control and an exclusive lock, so only main deploys and runs never overlap. Production adds an approval by the release group, a required template check and an Azure Monitor alert query, so a release cannot start while an incident is open. The same pipeline file serves all three. Nothing about the gates is visible in the YAML, which is why a contributor cannot weaken them in a pull request without also having rights on the environment itself.

Decisions and trade-offs

Approval or automated check? Automated checks are faster and consistent, but they only catch what they were written to catch. Use approvals where context matters, such as a customer-facing change in a quiet trading period.

One production environment or several? A single environment is simpler. Splitting by region or customer tier lets you gate them separately, at the cost of more configuration.

Environment checks or pipeline conditions? Conditions in YAML are editable by anyone who can edit the pipeline. Checks on the environment are not. For anything that must hold, use checks.

When not to add gates. A team shipping an internal tool ten times a day with feature flags and fast rollback may need only branch control and an exclusive lock. Extra approvals would cost more than they protect.

Common failure modes

  • Rubber-stamp approvals. The approver clicks through without reading. The cure is fewer, better-informed gates.
  • Single approver. Release blocked while they are on leave.
  • Gate on the wrong object. Approval placed on a stage condition rather than the environment, so another pipeline bypasses it.
  • No emergency path. Teams invent their own, usually worse than a designed one.
  • Stale queues. Without a lock strategy, old runs deploy after newer ones. Set the lock to cancel or queue deliberately.

Delivery and handover

You receive configured environments, checks defined and documented, example deployment jobs, approver groups with a rota, an emergency release procedure and a test log showing that blocked runs are blocked. Where an approval trail is needed for an audit, we show where the evidence lives and how to export it.

How to tell it is working

Production deployments come only from the protected branch, no approval sits unread for days, release frequency does not fall after gates are introduced, and an auditor’s question about who approved a given release is answered in minutes. If you want your release path reviewed, book a consultation.

References

How we deliver it

  1. 01

    Map the release path

    We document how a change travels from merge to production today, who signs off, and which of those sign-offs actually catch problems.

  2. 02

    Define environments

    Environments are created per target (and per Kubernetes namespace or virtual machine group where useful) with clear names and owners.

  3. 03

    Choose gates by risk

    Each environment gets only the checks it needs: approvals, branch control, business hours, health queries or exclusive locks.

  4. 04

    Write the deployment jobs

    Pipelines use deployment jobs with a deployment strategy, so history, rollback hooks and checks all attach correctly.

  5. 05

    Test the refusals

    We prove that an unapproved run waits, a feature branch is blocked, and a timed out approval fails cleanly.

  6. 06

    Hand over and tune

    Approver groups, an emergency path and a short runbook are documented, and gates are reviewed after the first few releases.

Tools and technologies

Azure PipelinesAzure DevOps EnvironmentsApprovals and checksDeployment jobsAzure MonitorAzure BoardsAzure Key VaultTerraformAKS

Frequently asked questions

What is the difference between an environment and a stage in Azure Pipelines?
A stage is a unit of the pipeline, while an environment is a named deployment target that exists outside any single pipeline. Checks and approvals attach to the environment, so they protect it regardless of which pipeline deploys. A stage deploys to an environment through a deployment job.
Can I require approval in YAML pipelines?
Approvals are configured on the environment in the Azure DevOps UI or API, not written in the YAML itself. The YAML references the environment in a deployment job, and the run pauses automatically when checks apply. This keeps developers from removing the gate by editing the pipeline file.
How do I stop approvals slowing every release?
Only gate where a human adds judgement. Lower environments should use automated checks or none. For production, use a small approver group, route notifications well and set sensible timeouts. If approvers click through without reading, the gate is giving false comfort and should be redesigned.
Can a developer approve their own deployment?
Yes, unless you stop it. The approval check has a setting that prevents requesters from approving their own runs, and we normally enable it for production. This separation of duties is often what auditors expect, but it needs enough eligible approvers to avoid delays.
Are classic release pipelines needed for gates?
No. Multi-stage YAML pipelines with environment checks cover most needs, including approvals, branch control and invoking external checks. Classic release gates are older, and we usually migrate teams towards environments when they modernise their pipelines.

Talk to an engineer about azure devops environments approvals and checks

Book a free 30-minute call. We review your current setup and tell you honestly whether and how we can help.

Written by Saddique Khan, DevOps / SRE / Cloud Consultant Engineer. Last updated 2026-10-08.