How To Deploy .NET Core on Azure App Service with Azure DevOps CI/CD — Part 01

Muhammad Rafay
4 min readSep 12, 2023

--

Learn how to deploy your ASP.NET Core app to Azure App Service using Azure DevOps. This blog post will guide you through creating a project and deploying an app service. We’ve covered you, from setting up Azure DevOps to deploying your app.

Here is the general architecture diagram that we will be deploying.

Architecture Diagram

Step 01: Create a New ASP .Net Core Project

To create a Hello World application, we will be using Visual Studio. Follow these steps:

  1. Open Visual Studio and click on “Create a new project.”
  2. Select “ASP.Net Core WebApp”.
  3. Enter the project name, solution name, and location. Then, click on “Next”.
  4. Choose the .Net framework that suits your project and click “Create.”
  5. Once the process is complete, you will see the output.
ASP .Net Core Project

Until now, we have successfully created the project. Now, we will test whether it is working. Run the project and click on the play button. After running the application, you will get the following output.

Hello World Application

How Dot Net Build Works?

Before running or building the project, it’s essential to comprehend how .NET Core constructs the application.

These are the steps created by .NET:

  1. Package Restoration: .NET Core initiates by restoring all the required packages from NuGet. This step ensures that your project can access the necessary dependencies.
  2. Solution File Compilation: The next phase involves compiling the solution file of your project. This compilation process transforms your source code into executable files and assemblies.
  3. Publication: Upon completing the build, .NET Core publishes the contents of the ‘bin or obj’ folder. This folder houses the vital .dll and other configuration files for deploying your .NET project into a production environment.

Upon completion of the project, the build files have been generated successfully. You may find your published files inside the “obj or bin” folder.

Step 02: Deploy Azure App Service: -

After successfully creating the project, we will move forward, and now we will deploy the web app service to host our .Net core application on the Azure platform, but first, let us understand what Azure app services are.

What are Azure App Services?

Azure App Service is a fully managed platform-as-a-service (PaaS) offering by Microsoft Azure that simplifies the deployment and management of web applications, APIs, and mobile app backends. It provides a scalable and highly available environment for hosting applications without managing underlying infrastructure.

You can learn more about its key features in the official docs of Microsoft Azure app services.

Here are the refined steps for deploying an Azure Web App Service to Azure:

  1. Access the Azure Platform: Access the Azure platform and navigate to the Azure Portal.
  2. Search for App Service: Within the Azure Portal, search for the “App Service” option. You can do this by using the search bar or navigating the menu.
  3. Create a New Web App: Click the “Create” button and select the “Web App” option. This initiates the process of creating a new web application.
  4. Basic Configuration: In the “Basics” tab, configure the essential fields. Choose your desired resource group for organizing resources and Specify a unique and meaningful name for your project, as this will become the URL of your application.
  5. Publish Configuration: In the “Publish” section, choose the “Code” method and select the appropriate runtime stack, which should align with your project’s requirements. For instance, you can select .NET 7 or a stack that suits your project.
  6. Region Selection: Proceed to the next step, where you’ll select the desired region for hosting your web app. You can typically leave the other fields at their default settings.
  7. Review and Create: Click the “Review + Create” button to initiate the deployment process. Azure will validate your settings and create the Web App Service accordingly.
  8. Deployment Progress: The creation process usually takes a minute or less. Azure will display an output indicating the deployment status, and once completed, your Azure Web App Service will be ready for use.

By following these steps meticulously, you’ll have your Azure Web App Service up and running, primed for hosting your web application efficiently.

The output will be displayed below.

Azure App Service

Copy the default domain or click the browse button to view the default application.

Default Web Page

Our app service is running successfully, and we are now waiting for our content. In the next chapter, we will advance to the next phase in our implementation process by utilizing the capabilities of Azure DevOps to improve further and simplify our deployment process. Keep following along as we explore the details of effective application deployment within the Azure system.

--

--

Muhammad Rafay

Software Engineer, DevOps/SRE | Data, MLOps, & Cloud☁️Infrastructure 💻| Golang 🚀 Open to collaborations & sharing insights!