Azure DevOps Pipelines 101
What Are Azure Pipelines?
Azure Pipelines is a CI/CD service in Azure DevOps that automatically builds, tests, and deploys your code. Pipelines are defined in YAML files and stored alongside your source code.
Pipeline Structure
trigger:
branches:
include:
- main
paths:
exclude:
- docs/*
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: Build
jobs:
- job: BuildJob
steps:
- checkout: self
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '8.x'
- script: dotnet build --configuration Release
displayName: 'Build solution'
- stage: Test
dependsOn: Build
jobs:
- job: TestJob
steps:
- script: dotnet test --configuration Release
displayName: 'Run tests'
Key Concepts
Triggers
Control when your pipeline runs:
- CI Trigger — On push to specified branches
- PR Trigger — On pull request creation/update
- Scheduled — Cron-based schedules
- Manual — Triggered via the portal or API
Variables
variables:
buildConfiguration: 'Release'
# Variable group (linked from Library)
- group: 'production-secrets'
# Inline
- name: deployRegion
value: 'uksouth'
Conditions
- stage: DeployProd
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
Agent Pools
| Pool Type | Description |
|---|---|
| Microsoft-hosted | Pre-configured VMs (ubuntu-latest, windows-latest, macos-latest) |
| Self-hosted | Your own machines with custom tools and network access |
Artifacts
Share build outputs between stages:
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'drop'
Next Steps
- Learn about multi-stage deployment patterns
- Set up infrastructure deployment with Terraform
- Deploy Logic Apps via Azure DevOps
- Deploy API Management via Azure DevOps