0PricingLogin
Azure Fundamentals · Lesson

Continuous Deployment to Azure

Extend the pipeline with a deployment stage that pushes the build artifact to an App Service slot, runs smoke tests, and swaps to production on approval.

What Is Continuous Deployment?

Continuous Deployment (CD) automatically releases every change that passes CI tests to production without manual intervention. Continuous Delivery is the softer version — it automates deployment up to a staging environment and requires a human approval gate before production. Both practices are built on the same pipeline infrastructure. In Azure Pipelines, CD is implemented by adding deployment stages after the CI stage, targeting Azure environments with approval gates as needed.

Multi-Stage Pipeline: CI + CD

A complete CI/CD pipeline has at least three stages: Build (compile, test, publish artifact), Deploy to Staging (deploy artifact to a non-production slot), and Deploy to Production (swap slot or deploy after approval). Stages pass the artifact forward via pipeline artifact storage. The staging stage runs integration or smoke tests automatically; the production stage waits for manual approval before proceeding.

# azure-pipelines.yml: multi-stage CI/CD
trigger:
  branches:
    include: [main]

pool:
  vmImage: ubuntu-latest

stages:
- stage: Build
  jobs:
  - job: BuildApp
    steps:
    - script: npm ci && npm run build
    - task: PublishPipelineArtifact@1
      inputs: {targetPath: dist, artifactName: webapp}

- stage: DeployStaging
  dependsOn: Build
  jobs:
  - deployment: StagingDeploy
    environment: Staging
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureWebApp@1
            inputs: {appName: myapp-staging, package: '$(Pipeline.Workspace)/webapp'}

- stage: DeployProduction
  dependsOn: DeployStaging
  jobs:
  - deployment: ProductionDeploy
    environment: Production   # Has manual approval gate
    strategy:
      runOnce:
        deploy:
          steps:
          - task: AzureWebApp@1
            inputs: {appName: myapp, package: '$(Pipeline.Workspace)/webapp'}

All lessons in this course

  1. Azure DevOps Services Overview
  2. Building a CI Pipeline with Azure Pipelines
  3. Continuous Deployment to Azure
  4. GitHub Actions on Azure
← Back to Azure Fundamentals