Pipeline as code with YAML in Azure DevOps

Avina Jain
Avina’s blog
Published in
2 min readApr 14, 2021

Azure DevOps offers two kinds of pipelines, Classic pipelines and YAML (Yet Another Markup language) pipelines. Initially, YAML pipelines may feel intimidating as compared to Classic, but they offer some great advantages. Let’s discuss some in this article.

One of the major advantages is that you can manage yaml files and in turn the pipeline, along with the source code in your repository. Since it is a text file, it is easier to edit and collaborate, and the changes can be committed and pushed just like any other file in your repository.

A great way to get started with the YAML pipelines is by exporting your already present Classic pipelines as YAML and go through it. The classic pipeline stays as is after export and we just get the YAML version of it. It is similar to exporting the pipeline in JSON format. Since you already understand the flow of a Classic pipeline, it will be then easier for you to understand how a YAML is written.

You can just browse to any one of your Classic pipelines, click on the Overflow menu (three dots) and click on Export to YAML -

Export to YAML
Export to YAML

You can then check out the official documentation provided and refer to it while going through the YAML pipeline. The documentation is extensive and useful.

Another great thing about YAML pipelines is Templates. You can export reusable sections of your pipeline to a separate file. These separate files are known as templates. You can then call them in the main YAML file as many times as you want with different parameters. Templates themselves can include other templates.

YAML pipelines are also useful when you are using containers. You can define container jobs in YAML so that each step of the job runs inside a container. Container jobs are not available in classic pipelines.

These are just a few advantages to make you feel optimistic and get yourself started with YAML pipelines.

I hope you found this helpful as you get started with and learn more about YAML pipelines! 😀

--

--