Getting started with Azure DevOps — CI/CD Pipelines

Sanjeev Mishra
6 min readApr 8, 2020

--

Microsoft has launched Azure DevOps recently and its worth a try. Dev(Sec)Ops has been there for quite a while now and tech companies have been trying hard to implement devOps practices using a wide range of tools. All the big tech players want to provide a more integrated development environment as much as possible so that it’s easier for the teams to manage projects without having to sign-up for 10s of different services and increase integration complexity. This is indeed a good direction to move in. However, I think, it’ll always be debatable whether to stick to one stop for all solutions or to get the best of the breed for the job at hand. I personally think “it depends :)” on a lot of context, like:

  • dev skills and capacity you have for cross integration of different tools
  • how invested you are with an existing vendor already
  • time and budget you have
  • etc etc

I have seen it go both ways and I would say do what you think is best in your situation. Just keep in mind that your job as DevOps engineer is to make automation of operations super easy and transparent and scalable. If you can do it well enough without comprising the quality and without going to 10 different vendors, thats best situation to be in. A detailed discussion for another time I guess.

Having said that, coming back to the topic, all the big tech giants (specially cloud providers) are trying their best to become one stop shop for all the development and deployment tools so that their customers do not have to go anywhere to experience an integrated project life cycle. One such company is Microsoft. Microsoft’s cloud offering is called Azure and its DevOps solution is called Azure DevOps.

Azure DevOps has a lot of offerings for different phases of a project management and delivery, however, in this article, we are going to focus on CI/CD automation using Azure DevOps Pipelines. Azure pipelines help in automating the software build and release process and setup a continuous integration and delivery (CI/CD) process.

Other alternate CI/CD service providers are GitHub Actions, GitLab Pipelines, AWS codepipeline, GCP CI/CD

Alright, let’s get started with Azure DevOps Pipelines …

Step1: Signup for free Azure DevOps account

The first thing that you need to have is an azure account. You can signup for a new one or sign-in with an existing Microsoft / GitHub account.

Step2: Create an Organization

Before you can begin creating a new DevOps project, you need to create a New Organization. C.lick on “New Organization” on the left hand menu to create one now (or you can choose to use an existing organization)

Step3: Create a Project

Once the organization is created, you need to create a new project like below:

Choose any name you like, we are creating “Azure DevOps Pipeline Tutorial” for the sake of this tutorial. When the project is successfully created, you’ll see the dashboard of the project like below:

On the left menu, you’ll notice a range of services/tools like Boards, Repos, Pipelines, Test Plans, Artifacts that Azure DevOps has to offer. You can update which services you want to use by turning them on/off from the Project Settings (bottom button on the left menu)

Step4: Create/Import a Repo

Before we begin to build pipeline, we need to have a code repository to build pipeline for. If you already have a code repository anywhere else (like GitHub, BitBucket, any private git repository, or Subversion) and want to import it to build the pipeline, you can skip this step and directly more to the next step to create the pipeline.

I am choosing to create a new Azure repository for the sake of this article. To create a new azure repo, click on Repos on the left menu to open the following page:

You’ll see a default repository created with the name of the project. You can either choose to use the default repository, or create a new repository. I am creating a new empty repository (without even the README.md file) named “pipeline-demo” as shown below. The reason to create empty repo is to be able to get instructions to push existing code to this repo. The newly created repository looks as below:

Next, import the code to this repository following the instructions on the new repo page. Now that we have a repository, its time to build a pipeline for this repo.

Step5: Create Azure Pipeline

You can create a new pipeline by either clicking the Set up build button on the repository page as shown below:

OR

by choosing Pipelines from the left menu and clicking Create Pipeline button as shown below:

We’ll use the second option, as it covers the longest journey of creating a pipeline. When you click the Create Pipeline button, you’ll be asked to choose the location of code repository that you would like to build pipeline for. The choices are as follows:

For the sake of this tutorial, I choose Azure Repos, which opens the following page showing all the azure repos from your projects:

Lets choose the pipeline-demo repository that we created before.

Next step is to Configure the pipeline strategy. There are a number of options available (click Show More button to reveal all the options) which can help you build a starter template pipeline to deploy web application, deploy azure functions, container images, build and deploy maven sprintg-boot application, deploy azure App Service from container images etc etc. For the sake of this tutorial, I am going to choose Starter Pipeline

Choosing Starter pipeline, will generate azure-pipelines.yml file (you can rename this file later if you want to) as shown below:

Your pipeline is ready to run. The basic pipeline shown above is already configured to use cloud build agents to run the pipeline. Click Save and Run button to run the pipeline.

Once the run is complete, you can see the results:

Clicking on the job, you can also see the detailed pipeline run logs as below:

Notice all the steps like initialize, checkout, …, finalize above? These steps are injected by default when you create a pipeline. You can control some of these steps, for example, if you do not want to checkout the code for every stage of the pipeline, then you can specify so in the azure-pipelines.yml file.

To do a lot more with azure pipelines, please visit the official documentation

Next I’ll cover How to automate deployment of spring-boot docker container application with MySQL Database on Azure using Azure DevOps Pipelines

Please leave your feedback, suggestions in comments below. Thanks for reading!

--

--

Sanjeev Mishra

Developer | Views expressed here are strictly mine, not of my Employer