Setting Up a Pipeline
To create a new pipeline, you start by signing in to your Azure DevOps organization and navigating to the Pipelines section. You then select "New pipeline" and choose where your source code is stored, such as GitHub or Azure Repos Git. From there, you can either select a pre-built template or define your own custom logic in a YAML file. The YAML file lives in your repository alongside your code, so changes to the pipeline are version-controlled just like any other file.
Example Build Pipeline
A typical build pipeline for a .NET application shows how the layers fit together. The trigger field tells the pipeline to run automatically whenever changes are pushed to the main branch. The pool field specifies which type of virtual machine agent to use, in this case a Windows image. The steps section lists the tasks in order: first restore NuGet packages, then build the solution with MSBuild, and finally publish the build artifacts to a staging directory so they can be used later by a release pipeline.
Deploying to Azure
When it is time to deploy to Azure, you add deployment tasks that target a specific Azure service. For example, the AzureWebApp task deploys a packaged application to an Azure App Service. This task requires two pieces of information: an azureSubscription that connects your Azure DevOps organization to your Azure subscription, and the appName of the target web app. The package input points to the artifact that was published in the build stage, so the build and deploy stages are linked through the artifact.
Benefits of YAML Pipelines
Using YAML pipelines brings three main advantages. Consistency ensures that the same build and deployment process runs in every environment, because the pipeline definition is the single source of truth. Modularity comes from templates and variables, which let you reuse pipeline logic across multiple projects without copying and pasting. Scalability means the pipeline can handle increasing workloads automatically, because Azure DevOps manages the agents and the queue. Together, these practices create robust, repeatable, and automated DevOps workflows.