Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center - Part Three

This article demonstrates how to generate Azure DevOps CI and CD Pipelines from Azure Web App Deployment Center. This technique saves a lot of time for DevOps Engineers as they need not create or configure Continuous Integration and Continuous Deployment Pipelines manually and can generate these with a few button clicks in the Azure portal.

Setting the Context

 
In the first article of this series, we developed an ASP.NET Core application and created a Docker Compose file to package the application in a Linux container. Then we configured an Azure DevOps pipeline continuous integration build to push this image to Azure Container Registry. In the second article, we pulled the image from the Azure Container Registry and deployed it to Azure Web App for Linux Containers using Azure pipeline continuous deployment build. Below are links to the first and second article in this series.
Configuring a Continuous Integration pipeline and a Continuous Deployment pipeline manually as we did in the previous articles of this series is really not needed. This is very much automated and can be done using a few clicks inside the Azure portal for the Web App in no time. However, the pipelines that get generated are basic ones and just do the job of generating the build and then deploy it to the Web App.
 
In the real production scenarios, there are a lot of other activities that get executed as part of these pipelines like running a code review and a unit test cases suite before generating the build, and running the build verification test as part of the continuous deployment pipeline. Usually, the basic pipelines are generated in an automated way and then they are enhanced to incorporate such additional tasks.
 
To enhance these pipelines, it is very much essential to have the knowledge on how to set these up manually. That is the reason why this series got kicked off with articles that demonstrated setting up these pipelines manually and now in the final article of this series the automated generation of these build pipelines is demonstrated.
 
Below steps performed in this article will demonstrate automating Azure DevOps pipeline generation for the Azure Web App.
  • Step 1: Create a new Web App for Linux Containers.
  • Step 2: Configure settings in the Web App to generate Continuous Integration and Continuous Deployment pipelines.
  • Step 3: Go to Azure DevOps and verify if the builds are created.
  • Step 4: Make changes in the Azure Repos and verify if the builds get triggered and the changes reflect in the Web App.

Create a new Web App for Linux Containers

 
Go to Azure portal and click on "Create a resource".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Click on "Compute".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Click on "Web App for Containers".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Provide App name, Subscription, Resource Group, and App Service Plan. Select OS as Linux. In the first article of this series, we had created a Container Registry. Let us use the same Container Registry and we can pick up the latest build in the container. Click on "Configure Container".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Select "Single Container" >>> "Azure Container Registry".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Select the Registry we had created in the first article along with the Image and Tag. Click on "Apply".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Click on "Create".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
The Web App for Linux Containers is commissioned.
 

Configure settings in the Web App to generate the Continuous Integration and Continuous Deployment pipelines

 
Go to the newly commissioned Web App. Click on Deployment Center. Click on Get started.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Select Source as Azure Repos. We have our code base in Azure Repos. Click on Next.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Select Repository details as in your Azure Repos. Click on Next.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Select the Docker File we had created in the first article. Click on "Next".
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Select the Container Registry we had created in the first article and click on "Done". 
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
The pipelines for Continuous Integration and Continuous Deployment gets generated automatically in Azure DevOps. The build gets triggered and the code gets deployed to Azure DevOps.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 

Go to Azure DevOps and verify if the builds are created

 
Go to the project inside Azure DevOps.Click on Builds. We can see that the Continuous Integration build is generated.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
Click on Releases. We can see that the Continuous Deployment build is generated.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 

Make changes in the Azure Repos and verify if the builds get triggered and the changes reflect in the Web App

 
Now go to the Azure Repo and make some change in the source code. Continuous Integration and Continuous Deployment builds that get generated will get triggered as soon as we commit the changes. We can see that a new image with tag 38 is pushed now in the registry by the Continuous Integration build. When the build was generated from Web App Deployment Center, it got triggered for the first time.
 
During the first run, a new repository got created and a container image with tag 37 got pushed to it. When we made changes in the source code and committed the changes container image with tag 38 got pushed to the new repository.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 
After the successful completion of Continuous Integration build Continuous Deployment build got triggered, the container image with tag 38 got deployed to the Web App.
 
Deploy .NET Core Application To Linux Containers On Azure Web App using Deployment Center
 

Winding up

 
In this article, we did not create the Azure DevOps pipelines manually. Instead, we generated the pipelines from Azure Web App Deployment Center. The pipelines generated are basic ones and can be manually enhanced to accommodate other DevOps activities like running Unit Test cases, automated code reviews and many more as part of these pipelines. Deployment Center option saves a lot of bandwidth for the DevOps engineer by enabling automation of the creation of the basic pipeline.