Implementing Azure DevOps CICD for Azure Web Apps

What is Azure App Service?

Microsoft Azure App Service is a fully managed platform for building, deploying and scaling web apps. It is a PaaS (Platform as a service) that enables us to quickly deploy our app without worrying about infrastructure and performance.

We can develop our favourite language, be it .NET, .NET Core, Java, Ruby, Node.js, PHP, or Python. Applications can be run and scaled with ease in both Windows and Linux-based environments. Azure App Service does not only add the power of Microsoft Azure to your application (security, load balancing, autoscaling, and automated management), but it also takes advantage of its DevOps capabilities, such as continuous deployment from Azure DevOps.

What is Azure DevOps?

Azure DevOps is a Software as a service (SaaS) platform from Microsoft that provides an end-to-end DevOps toolchain for developing and deploying software. It has many inbuilt functionalities that allow teams to get up and running with managing projects and automating the workflows. Some key features in Azure DevOps are creating Build and Release pipelines for CI/CD automation, project board, organization, and code repository capabilities.

Before we start, please have a look at the architecture diagram shown below. This diagram is probably the simplest form of any client-server architecture suited for smaller projects or exercise projects. We are using it only to demonstrate the deployment of any web application with the minimum configuration.

Advantages of Azure Pipelines:

The Azure Pipelines can be multifactored, and in the Azure DevOps CI/CD practice, they provide various advantages:

Version Control Systems — Having the code into a version control system is the first step of building an Azure CI/CD pipeline. You can manage your source code in GitHub, Bitbucket, Subversion, or any other Git repository. It also supports Team Foundation Version Control (TFVC).

Programming Languages and Application Types — You can use different languages with Azure pipelines like Java, Ruby, C, C++, Python, PHP, Go, and JavaScript.

Deployment Targets — The applications with Azure CI/CD pipelines can be deployed to multiple target environments. This includes Virtual Machines, Containers, or any On-prem or Cloud Platform.

Pricing — It is free for public projects. But, for private projects, you can run up to 1800 minutes of pipeline jobs free per month.

Azure DevOps CI & CD Process in Web Apps:

In this architecture diagram, we describe the Azure DevOps pipelines features to help our application to get build with Azure DevOps CICD pipeline to Azure Web Apps.

Azure Web Apps Deployment Strategy:

  1. The developer checks in the source code to the Azure code repository.
  2. Azure Continuous Integration pipeline triggers the build by cloning the application code from Azure repo to either Microsoft hosted build agent or self-managed build agents.
  3. Azure build agents are going to build the job and generate deployable artifacts, which can be pushed to a drop location in the artifact staging directory.
  4. Continuous deployment trigger orchestrates the deployment of application artifacts with environment-specific parameters.
  5. Once the release has run successfully, to view the web application deployed on Azure as a web application browse to the URL provided in the portal.
  6. The Logs tab will provide details of the entire release process steps to all environments run to deploy the web application to Azure.

Azure DevOps Build Pipeline for Continuous integration:

Continuous Integration or CI is a process when every time a developer commits or delivers source code changes to the version control repository, in this case, it is the Azure DevOps repo in which the build is performed either on every check-in or using a schedule.

Azure DevOps Release Pipeline for Continuous Deployment:

Since the build artifacts are available in the drop folder as in the build definition the release definition which we will create now for deployment will pick up the artifacts and then deploy them as an Azure web application.

Release pipelines in Azure Pipelines help your team continuously deliver software to your customers at a faster pace and with lower risk. You can fully automate the testing and delivery of your software in multiple stages all the way to production or set up semi-automated processes with approvals and on-demand deployments.