Azure DevOps CI CD Pipeline Step By Step

In this article, I’m going to walk you through the, step-by-step guide to building a robust Azure DevOps CI/CD pipeline. Whether you’re a Lead Architect or a Full-Stack Developer, this article will definitely help you.

Azure DevOps CI CD Pipeline Step By Step

What is Azure DevOps CI/CD?

CI/CD stands for Continuous Integration and Continuous Delivery (or Deployment).

  • Continuous Integration (CI): This is the practice of automating the integration of code changes from multiple contributors into a single software project. It involves automated building and testing.
  • Continuous Delivery (CD): This picks up where CI leaves off. It ensures that the code is always in a deployable state, automating the push to various environments like Staging, QA, or Production.

Azure DevOps provides a world-class suite of services to handle this entire lifecycle under one roof.

The Core Components of Azure Pipelines

To understand the tutorial below, you must be familiar with these four pillars:

ComponentDescription
TriggerThe event that tells the pipeline to run (e.g., a code push to the main branch).
StageA major division in the pipeline (e.g., “Build,” “Test,” “Deploy to Production”).
JobA series of steps that run on a single agent.
Step/TaskThe smallest building block, such as running a script or a NuGet restore.

Step 1: Setting Up Your Azure DevOps Environment

Creating Your Project

  1. Sign in to your Azure DevOps organization (e.g., dev.azure.com/YourCompany).
  2. Click + New Project.
  3. Name it something descriptive, like Retail-API-Automation.
  4. Set the visibility to Private (standard for most corporate environments).
  5. Choose Git for version control and Agile or Scrum for the work item process. Check out the screenshot below for your reference.
Azure DevOps CI CD Pipeline Step By Step
how to setup ci cd pipeline in azure devops

Configuring Service Connections

You cannot deploy to Azure without permission. You need to create a Service Connection to link Azure DevOps to your Azure Subscription.

  • Navigate to Project Settings > Service Connections.
  • Select Azure Resource Manager and use the Service Principal (automatic) option. This is the most secure method, often required by security audits in the financial and healthcare sectors.
azure devops ci cd pipeline tutorial

Step 2: Source Control and the “Shift Left” Mentality

In my experience, the best pipelines are built on clean code. We use Azure Repos to house our source code.

I strongly recommend implementing Branch Policies. In a high-stakes environment—say, a fintech startup in Charlotte—you should never allow direct pushes to the main branch.

  • Require at least two reviewers for Pull Requests (PRs).
  • Require a successful “Build” validation before code can be merged.

Step 3: Creating the Continuous Integration (CI) Pipeline

Now, let’s get our hands dirty with YAML. While Azure DevOps offers a Classic Editor (drag-and-drop), as a pro, I exclusively use