Skip to main content
Azure DevOps pipelines use YAML to define build and release workflows in a human- and machine-readable format. In this guide, we’ll explore YAML essentials, step through an ASP.NET pipeline example, and demonstrate how to leverage templates for reusable CI/CD components.
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:
Key elements:
  • 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:
The default YAML appears:
Validate and run to see output:

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:
List:
Nested mapping:

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
Reference templates in your main pipeline (azure-pipelines.yml):

Build and Test Summaries

After applying templates, review your build results in the pipeline summary:
Monitor recent runs and their status:
Check detailed logs to confirm test success:

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
Experiment with these patterns to streamline your Azure DevOps workflows.

Watch Video