Azure Devops Pipeline Setup Step by Step

CI&CD release pipeline

Azure devops is one of the best platform to start with the CI&CD pipeline for your application. It supports inbuilt logic, integration with azure and other tools for the automated process.

Below are the steps you need to follow for CI&CD pipeline setup:

Step1: Create an Microsoft account https://dev.azure.com

Step2: There are 2 steps for completing CI&CD in the azure devops

  1. Pipeline setup for you project
  2. Release setup for your pipeline

Pipeline setup for you project

Create a private/public project and select the work item process as Agile.

Once project gets created it will create the source code repo (in case you want to use this repo for your code base and check in your code) as below

Click on the “Use Classic Editor”
Click on the “Use Classic Editor”

Select the source repository (i.e. azure repos git, git, etc.) in this scenario we have selected the azure repos git. Now select the branch of the repo on which you want to trigger the build.

Select the development template for your code. In this scenario we have chosen ASP.NET Core template. You can choose from list of options provided based on your development language.

Based on selected template default tasks will gets created automatically(e.g. build, test, publish). These tasks are sequential and will gets triggered in the same sequence.

Tasks for the .net core api template

  1. Restore : This will do NuGet restore of the packages
  2. Build: This task will do dotnet build
  3. Test: This task will run the all unit test cases
  4. Publish: If you enabled to publish then it will publish your artifact
  5. Publish Artifact: This will create an artifact of your build package and put into workspace which will be used by the release pipeline for deployment.

Since we are going to use release pipeline for the deployment therefore we will uncheck the publish web project option from the task.

Trigger

For the continuous build and test we need to have automatic trigger. When code check-in happens in the branch then it will get triggered automatically and start executing tasks sequentially. To enable continuous integration select the checkbox as highlighted below:

Configuration

If you want to add any configuration properties then you can add in the variables section.

Now with all above settings you can click on the “save and queue”. Once it gets saved your pipeline will start running the tasks one by one and save the artifacts in the workspace.

When pipeline runs successfully, it will be shown as below :

Release setup for your pipeline

Click on the releases and add a new release pipeline and save :

Now first add the artifacts (i.e. your build package) which got generated in pipeline setup.

As per our scenario we want our application to get deployed in the stages for example, first it should deploy in dev environment and then once it gets approved by approver then it should deploy to the next stage TEST/QA/PROD.

For this we need to create these stages and then add task for each. To add tasks for each stage select the “Azure App Service deployment” and apply and follow the steps as per the screenshots below:

Note: We are deploying our application in azure webapps, you can choose your respective deployment source .

Select your subscription and then choose your webapp for the deployment.

In the same way create another 2 stages of QA and PROD as below :

In the above flow we have 4 stages DEV , TEST, QA, PROD and deployment will get triggered based on approval (if added)

In order to add the approver enable post deployment condition and add an approver for the next stage deployment.

To test the above scenario check-in your code to the master branch and check the build pipeline it will gets triggered automatically. And once build get completed it will deploy the application in the dev environment.

Hope this is helpful 👍.

Please share your feedback and comment, If you have enjoyed this article, click on follow to get updates on azure.

Microsoft certified Azure Solution Architect Expert | .Net full Stack developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store