How to Create a CI/CD Pipeline in Azure DevOps
Tags: azure, devops, ci, cd
Published: 2023-11-02 17:05:59

The cloud-based Azure DevOps platform is a popular choice for developers looking to implement a CI/CD (continuous integration/continuous delivery) pipeline. Azure DevOps provides a seamless way to connect your development workflow with the cloud-based Azure services that can help to accelerate your application delivery. In this tutorial, we will walk through the process of setting up a CI/CD pipeline in Azure DevOps for a .NET Core web app. We will start by creating a new Azure DevOps project, then adding a .NET Core web app to the project. Next, we will create a CI/CD pipeline that will automatically build and deploy our web app to Azure. Finally, we will test the pipeline by making a change to our code and verifying that the change is automatically deployed to Azure.

Creating a new Azure DevOps project

The first step is to create a new Azure DevOps project. We can do this by going to the Azure DevOps portal and clicking on the "New Project" button.


In the "New Project" dialog, we will give our project a name and description, then click on the "Create" button.

Adding a .NET Core web app to the project

Once the project has been created, we will add a .NET Core web app to the project. We can do this by clicking on the "Add" button in the "Applications" section of the project overview page.

In the "Add an application" dialog, we will select the "ASP.NET Core web app" template, then click on the "Create" button.

Creating a CI/CD pipeline

Now that we have our web app added to the project, we can create a CI/CD pipeline to automatically build and deploy the app to Azure. We can do this by going to the "Pipelines" section of the project and clicking on the "New Pipeline" button.

In the "Select a Source" dialog, we will select the "Azure Repos Git" option, then click on the "Continue" button.

On the "Configure your pipeline" page, we will select the "Starter pipeline" template, then click on the "Continue" button.

In the "Edit the pipeline" dialog, we will scroll down to the "Azure App Service Deploy" task and click on the "Enabled" checkbox. We will then enter our Azure subscription details and select the web app that we want to deploy to. Finally, we will click on the "Save & queue" button to save our changes and queue up a build.

Testing the pipeline

To test our pipeline, we will make a change to our code and push the change to our Azure Repos Git repository. We can do this by going to the "Changes" section of the Azure DevOps portal and clicking on the "New change" button.

In the "New change" dialog, we will make a change to the code and click on the "Commit" button.

Once the change has been committed, we can go to the "Builds" section of the Azure DevOps portal to see that a build has been triggered. We can also see the status of the build and deploy tasks on the build page.

Finally, we can go to the Azure portal to verify that the change has been deployed to our web app.

As we can see, it is relatively straightforward to set up a CI/CD pipeline in Azure DevOps for a .NET Core web app. This can save a lot of time and effort when it comes to manually building and deploying your app.