Azure DevOps, CI/CD pipelines Explained

Azure DevOps is a cloud-based platform for developing, building, and deploying software. It includes a range of tools and services for version control, collaboration, build and release management, and more.

One of the key features of Azure DevOps is the ability to create pipelines for continuous integration and continuous delivery (CI/CD). These pipelines allow you to automate the build, test, and deployment of your code, ensuring that your software is always up-to-date and ready for release.

To create a pipeline for CI/CD with Azure DevOps, you’ll need to use a YAML file to define the steps in your pipeline. This file specifies the tasks that your pipeline should perform, as well as any dependencies or resources that it needs.

Here is an example of a simple pipeline defined in YAML:

name: My Pipeline

  - repo: self

  - job: Build
      vmImage: 'windows-latest'
      - script: |
          echo Building the app...
          dotnet build
        displayName: 'Build the app'

  - job: Test
      vmImage: 'windows-latest'
      - script: |
          echo Running tests...
          dotnet test
        displayName: 'Run tests'

This pipeline defines two jobs: a “Build” job that builds the app using dotnet build, and a “Test” job that runs tests using dotnet test. You can add additional jobs and steps to your pipeline as needed to perform other tasks, such as deploying your app to a test or production environment.

Overall, Azure DevOps pipelines with YAML allow you to easily automate the build, test, and deployment of your code, helping you to deliver high-quality software quickly and reliably.

When to use CI and when to use CD pipelines

Continuous integration (CI) and continuous delivery (CD) are two closely related software development practices that aim to improve the speed and quality of software development by automating the build, test, and deployment process.

Continuous integration involves regularly integrating code changes from multiple developers into a shared repository, and automatically building and testing the code to ensure that it is stable and functional. The goal of CI is to detect and fix problems early in the development process, so that they don’t accumulate and become more difficult to fix later on.

Continuous delivery extends the principles of continuous integration by automating the deployment of code changes to production environments. With CD, every code change is automatically built, tested, and deployed to a production-like environment, allowing you to release new features and updates to users quickly and safely.

In general, it’s a good idea to use both CI and CD in your software development process, as they can help you to detect and fix problems early, and ensure that your code is always ready for release. However, there may be cases where you only need to use one or the other, depending on your specific needs and constraints.

For example, if you are working on a small, low-risk project with a limited number of developers, you might only need to use CI to ensure that code changes are integrated and tested regularly. On the other hand, if you are working on a large, complex project with a high rate of change, you might need to use both CI and CD to ensure that code changes are integrated, tested, and deployed safely and efficiently.

Create a custom Pipeline Task in Azure DevOps

To create a custom task in Azure DevOps, you’ll need to follow these steps:

  1. Install the Azure DevOps extension generator: The Azure DevOps extension generator is a tool that helps you to create and package Azure DevOps extensions. You’ll need to install this tool in order to create a custom task.
  2. Create a new extension project: To create a new extension project, you’ll need to run the azure-devops-extension-generator command and follow the prompts to set up your project. This will create a new project directory with the necessary files and dependencies for your extension.
  3. Create a new task: In your extension project, you’ll need to create a new task by adding a new file to the src/tasks directory. This file should define your task’s metadata, such as its name, description, and inputs, as well as the code that should be executed when the task is run.
  4. Test your task: You can use Azure DevOps to test your task by adding it to a pipeline and running the pipeline. You can use the Azure DevOps extension tester tool to test your task in a local development environment.
  5. Package and publish your extension: Once your task is working as expected, you can use the tfx command to package and publish your extension to the Azure DevOps Marketplace. This will make your task available for other users to install and use in their pipelines.

Overall, creating a custom task in Azure DevOps involves installing the necessary tools, creating a new extension project, defining your task’s metadata and code, testing your task, and packaging and publishing your extension.

Example task

To create a custom task in a pipeline using Node.js, you will need to create a Node.js module that exports a function that performs the task. The function should accept a set of parameters as input, and it should return a Promise that resolves when the task is complete.

Here’s an example of a custom task that retrieves the current time from a remote server and logs it to the console:

const axios = require('axios');

exports.getCurrentTime = async (options) => {
  const response = await axios.get('');
  return Promise.resolve();

o use this task in a pipeline, you will need to install the required dependencies (in this case, axios) and require the module in your pipeline script. You can then invoke the task by calling the exported function, like this:

const myTask = require('./my-task');


You can pass any necessary options to the task function as an object, and you can use async/await syntax to handle the asynchronous nature of the task.

I hope this helps! Let me know if you have any questions or if you’d like more information.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at

Up ↑