Back to Blog
1 min read

Azure DevOps Environments and Deployments

Environments in Azure DevOps provide deployment targets with approval workflows, resource tracking, and deployment history. This post covers setting up and using environments effectively.

Configuring Environments

# Pipeline with environment deployments
trigger: [main]

stages:
  - stage: DeployDev
    jobs:
      - deployment: DeployToDev
        environment: 'development'
        strategy:
          runOnce:
            deploy:
              steps:
                - script: echo "Deploying to dev"

  - stage: DeployStaging
    dependsOn: DeployDev
    jobs:
      - deployment: DeployToStaging
        environment: 'staging'
        strategy:
          runOnce:
            deploy:
              steps:
                - script: echo "Deploying to staging"

  - stage: DeployProd
    dependsOn: DeployStaging
    jobs:
      - deployment: DeployToProduction
        environment: 'production'
        strategy:
          canary:
            increments: [10, 50, 100]
            deploy:
              steps:
                - script: echo "Deploying ${{ strategy.name }}"
            on:
              failure:
                steps:
                  - script: echo "Rolling back"

Environment Configuration

  • Approvals and checks
  • Deployment history tracking
  • Resource targeting (Kubernetes, VMs)
  • Exclusive locks
  • Business hours restrictions

Environments provide governance and visibility for deployments across your infrastructure.

Michael John Peña

Michael John Peña

Senior Data Engineer based in Sydney. Writing about data, cloud, and technology.