DevOps Pipeline Cheat Sheet
YAML Pipeline Structure
| trigger | branches, paths, tags — defines when pipeline runs |
| pool | vmImage: 'ubuntu-latest' or self-hosted agent pool |
| stages | Logical grouping: Build, Test, Deploy |
| jobs | Run on an agent, contain steps; can depend on other jobs |
| steps | task, script, bash, powershell, checkout |
| variables | Inline, variable groups, template expressions |
Common Pipeline Tasks
| UseDotNet@2 | Install a specific .NET SDK version |
| Npm@1 | npm install, build, test, publish |
| AzureCLI@2 | Run Azure CLI commands with service connection auth |
| AzureRmWebAppDeployment@4 | Deploy to Azure App Service |
| TerraformTaskV4@4 | Terraform init, plan, apply, destroy |
| PublishBuildArtifacts@1 | Publish artifacts for downstream stages |
Pipeline Best Practices
| Templates | Use extends and template references to reuse pipeline logic |
| Environments | Define environments with approval gates and checks |
| Service Connections | Use Workload Identity Federation for passwordless auth |
| Caching | Cache@2 task for node_modules, NuGet, pip to speed builds |
| Secrets | Store in Variable Groups linked to Azure Key Vault |
| Multi-stage | Separate Build, Test, Deploy stages with dependencies |