Home » Your Daily TechBytes » How to Execute DevOps Using Azure CI CD Pipelines
DevOps Pipeline CI CD

DevOps is of extraordinary significance and is the need of the hour for all technology companies. Various affiliations seek to coordinate this method for managing and further developing their company’s capacity. Azure is one of the main cloud service providers and supports a strong arrangement of DevOps administrations.  

This article explains Azure, its DevOps components, and its processes. It will assist you in the execution of DevOps using Azure. 

What is Azure? 

Microsoft Azure, commonly referred to as Azure, is a leading cloud computing service used for application management. It enables you to collect, send, and direct applications using Microsoft-managed data centers. As a cloud platform, Azure boasts over 200 products and services aimed at turning ideas into solutions that help tackle the challenges of our times.  

You can create, run, and manage multiple applications across different cloud environments, on-premises, or at the edge. The best part is that you can do all this using the tools and frameworks of your own choice! 

Azure offers the following services: 

  • Monitoring
  • Databases
  • Networking
  • Storage
  • Compute

Parts of Azure DevOps 

Let’s explore each of these individually. 

Azure Repos 

Consider it a home or storage for repositories. It gives you limitless cloud-based private Git repositories. You can pull, push, and commit your progressions to these vaults. 

Azure Pipelines 

In simple terms, an Azure pipeline is a stage where you construct, deploy, and test applications continuously. 

Azure Boards 

In the event that you have various groups dealing with a task, those groups will need to ensure efficient collaboration. Azure Boards does just that; it guarantees better working outcomes. Moreover, it enables you to manage accumulations and ensure the production of extraordinary custom reports. 

Azure Artifacts 

Azure empowers you to build, host, and divide packages between your teams. These artifacts serve a critical purpose; they ensure that your pipelines possess fully integrated package management. This is accomplished with nothing more than a simple click. You can create Expert, NPM, and NuGet bundles. Moreover, the size of your team is of little importance here. It doesn’t matter whether it’s a large team or a small one. 

Azure Test Plans 

It gives you an entire toolkit compartment that lets you perform start-to-finish, manual, and exploratory testing, guaranteeing your product works fine. 

Let’s turn our attention to DevOps now. 

What is DevOps?

DevOps is the most common way of coordinating the engineering and operations teams to further develop joint efforts and improve efficiency. You achieve this by automating your workflows to constantly gauge and measure an application’s performance. 

This definition might appear confusing to beginners since it carries multiple unexplained terms. Let’s explain those first, then. 

The quick deployment of software has become critical in today’s software-enabled world. The IT industry, in particular the software industry, is extremely dynamic. New software is launched daily, and older ones are updated on a regular basis. In such an environment, you can only deliver cutting-edge solutions if you keep yourself updated.  

How do you achieve that? You do it by enabling continuous software delivery and integration. It is here that software developers and engineers play a crucial role. 

Let’s explore the fundamental stages of designing Microsoft Azure CI/CD pipelines for a .NET Core MVC Web application. 

But first, make sure you have access to the following before you continue reading this article. 

  • Microsoft Azure Account 
  • Visual Studio 2022 
  • Azure DevOps Account 

What is CI/CD?

CI/CD is the abbreviation of Continuous Integration (CI) and Continuous Deployment (CD). 

Implementing the CI/CD pipeline is a vital element in the process of offering frequent and regular code changes. 

This article explains how to design Azure DevOps CI/CD pipelines and how to deploy an ASP.NET MVC web application to the Azure Web Apps platform. We will explain the first step by breaking it down into five stages.  

These steps are given below. 

1: Create the Project 

2: Create the Build Pipeline 

3: Create an Azure Web Apps account to host your website 

4: Design the Release Pipeline 

5: Deploy the application on Azure 

Step 1: Create the Project 

We create a new project in Azure DevOps and we have a sample MVC-based .NET web application using Visual Studio 2022. We are using GitHub as version control.

  • First, we have to log in to Azure DevOps
  • Create a new project in our organization of Azure DevOps

create the project

  • Open the Repo tab and click on the Branches. By using GitHub, we clone a project in our local machine

machine using

  1. Now we Clone the project in our local machine by using these Git commands

git clone <Clone URL>

Create a Dev branch

git checkout -b Dev

  1. Create a new MVC-based web application of .NET by using Visual Studio 20 on our local machine.
  2. Add a git ignore files in our project
  3. Then push our code to the Azure repo by using Git commands.

git add.

git commit -m “Code init”

git push

  • Now your local code is available in Azure Repos

Azure Repos

 

Step 2: Create the Build Pipeline

Now we will create a Build Pipeline of our project in Azure DevOps Services

  1. Navigate to the Build Pipeline of our project.

Pipeline       Build Azure Pipeline

 

Build Pipeline of Azure

  1. Now we need to select the platform according to our project (ASP.Net) for the pipeline configuration.

ASP.Net

 

  1. Here is the YAML file of our project

YAML File

Add the desired tasks and commands according to our project

4. Run the Pipeline after saving the YAML file

Saving YAML file

5. Our pipeline build is in progress

Pipeline is ready

  1. Wait until the Build Pipeline is successfully created

waiting for pipeline

 

Step 3: Create the Azure Web App to host our .Net application

  1. Create a Web App by selecting your Azure Subscription and Resource group or create a new resource group if you don’t have a Resource Group.

.net application

  1. Choose the name of your Web App, where you want to publish (docker container or code), Runtime stack, operating system, and region.

devops subscription

  1. Select the App Service Plan and SKU according to our project needs. I am using the Free F1 plan.

App Service Plan

  1. If we need to monitor our Web App, we can enable Application Insights like requests rates, failures, CPU, memory, and diagnostics tools.

microsoft azure

  1. After reviewing the specs, select the Create button for creating our Web App
  2. Now our Web App is successfully created.

Successfully creation

 

Step 4: Let’s Create the Release Pipeline

We will create our release pipeline and connect our Azure Web App with our release pipeline in this step.

  1. Click on a release button from the left side for creating a release pipeline.

Side Button

  1. Select a template for the release pipeline according to your project requirement and technology stack. I am selecting the Azure App Service deployment because we are using Azure Web App in our project.

Web Apps Platform

  1. Now create a Stage (Dev, QA, Prod) according to your project requirement.

Dev QA

  1. Add an artifact by clicking the Add Artifact button, also select the Source of the build pipeline, default version, and source alias.

artifacts

 

The artifact is successfully added.

Artifacts added

 

  1. Add Pre-deployment and Post Deployment conditions or approvals and then create a release by selecting Stage, Source version, and Artifact.

pre-development

 

pre development facts

The release is created successfully.

release created

 

Step 5: Deploy the application

  1. Click on a Deployment button or you can set an automatic trigger in our YAML file for auto-trigger deployment.

Deployment Button

2. Add a Comment if we need to add one.

add comment

3. Our deployment stage is in progress.

Deployment in Progress

4. Deployment succeeded successfully.

Deployment created successfully

5. Now go to our Azure portal and load our Azure Web App by clicking the URL.

DevOps Portal

6. Here is our cloud-hosted web application.

cloud based web application

Conclusion

This article has given a comprehensive overview of the Microsoft Azure cloud computing platform and the components and processes of Azure DevOps. Most importantly, it has explained the process of Azure DevOps Continuous Integration and Continuous Deployment pipelines. 

We hope this article helps you configure your Azure DevOps CI/CD pipeline and deploy your ASP.NET Core MVC web application to the Azure Web App resource. 

If you want any further assistance to execute DevOps using Azure, contact us at info@xavor.com

 

 

Share:

Muhammad Salman

Hafiz Salman is a DevOps Engineer at Xavor Corporation in the DevOps and Cloud Infrastructure team. He has worked on different projects for industries and his area of expertise revolve around DevOps latest technologies including AWS, Jenkins, Docker, Kubernetes, CICD, Terraform, Azure DevOps and GitHub actions. He’s a dynamic and creative professional with a passion to develop innovative solutions that expedite the efficiency and effectiveness of organizational success.