Azure DevOps Pipelines

💤0
Lv 10 XP
← 🔁 CI/CD & DevOps · Pipelines

Azure DevOps Pipelines

Intermediate ⭐ 80 XP ⏱ 16 min #cicd#azure-devops#pipelines

Build and release with Azure Pipelines — stages, jobs, and environments.

📖Theory

Azure Pipelines (part of Azure DevOps) defines CI/CD in a YAML file (azure-pipelines.yml). Its structure mirrors most systems:

  • Trigger — what starts the pipeline (branch pushes, PRs)
  • StagesJobsSteps/Tasks — tasks are reusable building blocks
  • Agents — run jobs (Microsoft-hosted or self-hosted agent pools)
  • Environments — deployment targets with approvals and gates
  • Service connections — authenticate to Azure/clouds; variable groups and Key Vault supply secrets

It integrates tightly with Azure (deploy to App Service/AKS) and provides approvals for controlled production releases.

🌍Real-World Example
trigger:
  branches: { include: [main] }

stages:
  - stage: Build
    jobs:
      - job: build
        pool: { vmImage: ubuntu-latest }
        steps:
          - script: npm ci && npm test
  - stage: Deploy
    dependsOn: Build
    jobs:
      - deployment: deployProd
        environment: production    # approvals attach here
        strategy:
          runOnce:
            deploy:
              steps:
                - script: ./deploy.sh
✍️Hands-On Exercise
  1. Identify the stage → job → step hierarchy in a pipeline.
  2. Add a deploy stage that depends on a build stage.
  3. Explain how an Environment enables an approval gate before production.
  4. Describe how a variable group or Key Vault supplies secrets to a pipeline.
🧾Cheat Sheet
ConceptDetail
TriggerBranch/PR that starts it
Stage / Job / StepPipeline hierarchy
TaskReusable step building block
Agent poolWhere jobs run
EnvironmentDeploy target + approvals
Service connectionAuth to clouds
Variable group / Key VaultSecrets/config
💬Common Interview Questions
How are Azure Pipelines structured?

A trigger starts the pipeline; stages contain jobs, which contain steps/tasks. Jobs run on agents, and deployment jobs target environments that can require approvals.

How do you add a manual approval before production?

Attach approvals/checks to the production Environment; the deployment job pauses until an authorized approver allows it to proceed.

📚Official Documentation

📝 My notes on this topic

Auto-saves as you type