How to create a Basic CI/CD Pipeline for ASP.NET core application in Azure DevOps.

CI/CD pipeline using Azure DevOps.

Shubham Shah
6 min readMay 31, 2023
[Cover post]

Hello Learners, in today’s fast-paced and ever-changing technological landscape, it is essential to have efficient software development and deployment processes in place. A CI/CD pipeline is one such process that enables developers to continuously integrate and deliver code changes to production with ease. In this article, we will discuss how to create a basic CI/CD pipeline in Azure DevOps, step-by-step.

Introduction

Creating a CI/CD pipeline can be a difficult task, especially if you are new to the concept and process. However, with the right tools and good amount of practice, it can be a straightforward and easy process. In this article, we will talk about the steps required to create a CI/CD pipeline in Azure DevOps.

What is a CI/CD pipeline?

CI/CD stands for Continuous Integration/Continuous Deployment, which is a software development approach that emphasizes frequent integration, automated testing, and continuous delivery. The pipeline is designed to ensure that each code change goes through a series of automated tests and validations before it is deployed to production. It is enable developers to build, test, and deploy their code efficiently and reliably. I hope you all are understand the brief overview about CI/CD pipeline.

Benefits of using a CI/CD pipeline

The use of a CI/CD pipeline offers several benefits to software development teams, including:

· Faster time to market.

· Improved product quality.

· Reduced Risks and Rollbacks.

· Increased team collaboration.

· Greater scalability and reproducibility.

· Continuous Improvement.

Azure DevOps overview

Azure DevOps is a comprehensive set of development tools and services provided by Microsoft that facilitates the planning, development, testing, and deployment of software applications. It offers a wide range of features and capabilities to support the entire software development lifecycle (SDLS), from idea to deployment and monitoring. Azure DevOps is commonly used for managing projects, version control, continuous integration and deployment (CI/CD), testing, and application monitoring.

You can head to Azure DevOps by this link or you can search Azure DevOps Portal on any browser which you familiar with.

Step 1: Creating a new account in Azure DevOps.

Once you reach on Azure DevOps portal you can start with Github or you can also create a free account and in the free account you can create unlimited private projects but you cannot create public projects.

Step 2: Creating a new project in Azure DevOps.

· After the signing in the account you have to select the organization where you want to create the project.

· Click on “create project” and enter a name of project and then add the description of the project.

· Select the version control system for your project, either it is Git or TFVC (Team Foundation Version Control).

· Click on “create” to create the project.

[Create a project]

Step 3: Importing a project in Azure Repos.

· Go to the “Repos” tab in Azure DevOps.

[Azure Repos]

· Now click on “import” and enter the repository clone URL of your source code.

· Click on clone and boom!! Your project has been successfully imported to Azure Repos.

[Files are imported]

Microsoft has temporarily disabled the free grant of parallel jobs for public projects and for certain private projects in new organizations. However, you can request this grant by submitting the following form:

https://aka.ms/azpipelines-parallelism-request

Please note that it takes us 2–3 business days.

Step 4: Creating a new pipeline (CI) in Azure DevOps.

  • Open the pipeline editor in Azure DevOps.
  • Click on “create pipeline” to create a new pipeline.

· Now, we will create a basic pipeline so that we use the classic editor (In the classic editor you don’t need to write a script).

[Create a pipeline]

· Select the resource, repository name, and default branch and hit the “continue” button.

[Fill the details and continue]

· Now, select a template according to your project here we deploy ASP.NET core project so that we have to choose ASP.NET core template or you can also start with a empty job and later you can add the jobs.

[Select a template]

· Now, enter a pipeline name, select agent pool and agent specification.

· Then go to Triggers (This is very important part of pipeline so be careful) and enable the continuous integration and select the branch.

[Trigger a pipeline]

· Now all the steps are over now you just have to hit save & queue button and then click on save & queue then comment for save the pipeline and click on save & run and done!!

[Save & Queue]
[Pipeline created]

Here our Continuous Integration (CI) pipeline was created. Now, our task is to create a Continuous Deployment (CD) pipeline.

Step 4: Creating a new pipeline (CI) in Azure DevOps.

  • Open the pipeline editor in Azure DevOps.
  • Click on “Releases” and then click on “New release pipeline” to create a new CD pipeline.
[Create release pipeline]
  • Now, select a template you can choose template according to your project here we have to choose Azure App Service Deployment but instead of that here I choose empty job for demo purpose.
[Select a template]
  • Then, enter a stage name whether it is Development, Testing, Production etc.
  • Now, click on job to add agent job of the stage. You can add agent job according to your stage.
[Add agent job]

Now, we have to add an Artifact basically an Artifact is the output of CI pipeline and it is the input for CD pipeline.

  • Click on “Add an Artifact” and select the source and click “Add” to continue.
[Add an Artifact]
[Select the source]
[Artifact sucessfully added]
  • You can also add more stages in release pipeline by clicking on “+ Add”.
  • At last click on “save” to save the pipeline and then you can create release.
[Save the pipeline]

Here for demo purpose I added 3 stages which is Dev, Test and Deploy.

Boom!! Your CD pipeline is successfully created.

Once again this is very basic level CICD pipeline a lot of new features are there in higher level pipelines.

Conclusion

Setting up a CI/CD pipeline in Azure DevOps can seem like a difficult task, but it is essential for efficient and seamless software development and deployment. By following the steps outlined in this guide, you can set up a CI/CD pipeline in Azure DevOps with ease.

You can also connect me on Linkedin.

Thank You :)

--

--

Shubham Shah

6x Microsoft Azure Certified Cloud Enthusiast | IT Student | Learner | UI/UX designer | DevOps