YAML is both concise and clear, making it ideal for version-controlled CI/CD definitions. Learn more at the YAML Official Site.
Example: ASP.NET CI/CD Pipeline
Use the following ASP.NET pipeline to build, test, and package your web application. For full task details, see the Azure DevOps ASP.NET docs.Starter Pipeline
Begin with a minimal YAML pipeline and customize it for your project:- trigger: Events that kick off the pipeline.
- pool: Agent selection (e.g.,
ubuntu-latest). - steps: Tasks or scripts to execute in sequence.
Viewing a Pipeline Run
A typical Azure DevOps pipeline run reveals build warnings, repository info, branch, and elapsed time:
Creating a New Pipeline
When you create a pipeline, select your source—Azure Repos Git, Bitbucket Cloud, GitHub, or GitHub Enterprise—and choose the Starter Pipeline for IntelliSense support:
YAML Structure Basics
YAML relies on three core constructs: key–value pairs, lists, and nested mappings. Use indentation for hierarchy and avoid tabs.
Examples:
Key–value pair:
Variables and Overrides
Define pipeline variables at the top and allow runtime overrides:Users can override
pipelineRunnerName and pipelineRunnerAge on the Run Pipeline screen. Ensure correct defaults to avoid unexpected behavior.Best Practices
- Leverage comments to clarify intent.
- Keep pipelines DRY by defining reusable variables and templates.
- Organize common logic into separate files.
Applying Templates
Break out common steps into parameterized or extendable templates. Example templates:nuget.yml
build.yml
test.yml
azure-pipelines.yml):
Build and Test Summaries
After applying templates, review your build results in the pipeline summary:


Conclusion
Azure DevOps YAML templates enable modular, maintainable CI/CD pipelines. You’ve learned:- Core YAML syntax and structure
- Defining variables and overrides
- Extracting and reusing templates
- Reviewing build and test outcomes
Links and References
- Azure DevOps Pipelines
- YAML Official Site
- Azure DevOps ASP.NET Pipeline Docs
- Azure Pipelines YAML Schema