A Step-by-Step Guide to Deploying a .NET MVC App on Azure App Services

Learn how to create an Azure App Service and deploy an ASP.NET 8 MVC application using Visual Studio publish profiles, with both import and Azure account-based deployment options.

A Step-by-Step Guide to Deploying a .NET MVC App on Azure App Services cover

Introduction

In this article, I will show a complete demo of deploying an ASP.NET 8 MVC application to Azure App Services. The flow is simple:

  • Create a ready-to-use MVC project
  • Create an Azure App Service from the Azure portal
  • Connect the app service in Visual Studio publish settings
  • Publish the project

There are multiple deployment methods for Azure App Service, but this guide focuses on Visual Studio's default publish workflow.

What Is App Service?

Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile backends. You can build in multiple stacks such as .NET, Java, Node.js, PHP, and Python, and run apps on Windows or Linux environments.

App Service also provides:

  • Security and load balancing
  • Auto-scaling and automated management
  • CI/CD integration with Azure DevOps, GitHub, Docker Hub, and more
  • Staging environments, custom domains, and TLS/SSL support

Read more in Microsoft's official documentation.

Create ASP.NET 8 MVC Application

As shown below, I created a simple ASP.NET 8 MVC application and added an extra paragraph for demo output.

Created ASP.NET 8 MVC project

When running the project locally, the output looks like this:

ASP.NET MVC app local output

Create Azure App Service

Log in to the Azure portal: https://portal.azure.com/

On the home screen, you will often see a direct option to create App Services.

Create App Service from Azure home screen

If it is not visible, search for App Services in the top search bar.

Search App Services in Azure portal

Open App Services and click Create. For this demo, select a basic Web App.

Create Web App in App Services

Basic Details

Provide the required project settings:

  • Subscription: select the subscription where the app service will be created
  • Resource Group: pick an existing group or create a new one
  • Name of App Service: provide a unique service name (used in the domain)
  • Publish: select Code for code-based deployment
  • Runtime Stack: choose .NET 8 for this project
  • Operating System: choose Windows or Linux
  • Region: select your deployment region
  • Windows Plan: pick an app service plan matching region and OS
  • Pricing Plan: choose based on traffic needs (Free tier for demo)

App Service basic settings

App Service pricing and plan details

These are enough to create the app service. Other tabs like database, deployment, and networking are optional and can be configured now or later.

Database

For this demo, no database is required, so this section is skipped.

Deployment

You can configure CI/CD so commits from GitHub or another source control system auto-deploy to App Service.

For this example, deployment settings are left unconfigured.

Deployment settings in App Service creation

Networking

In networking settings, define whether your app should be publicly accessible.

Networking configuration

If public access is turned off, users cannot access the app using the default public endpoint. This can be changed after creation.

Public access configuration option

Monitoring

Monitoring can be enabled to track app health, diagnostics, and other telemetry. This may add extra cost.

Monitoring setup

Tags

Tags are key/value pairs used to organize resources and improve management across environments.

Review and Create

Review all settings and click Create to provision your App Service.

Review and create App Service

After creation completes, click Go to Resource.

App Service created successfully

This opens the App Service dashboard with all configuration details.

App Service dashboard

Deploy Project on Azure App Service

There are many deployment options for App Service, including CI/CD, FTP, and Visual Studio publish. In this guide, deployment is done using Visual Studio by creating a publish profile.

Option 1: Import Publish Profile

First, download the publish profile from the Azure App Service overview page.

Download publish profile from App Service

In Visual Studio, right-click the project and select Publish.

Open publish from project context menu

In the publish wizard, choose Import Profile and click Next.

Choose import profile in publish wizard

Select the downloaded publish profile file and click Finish. A publish profile is added to the project.

Imported publish profile in Visual Studio

Option 2: Add Publish Profile Using Azure Account

You can also fetch App Service details directly from Azure in Visual Studio.

First, sign in to Visual Studio with the Microsoft account that owns the App Service.

Sign in to Visual Studio

Then right-click the project and select Publish.

Open publish menu

Select Azure and click Next.

Select Azure publish target

Choose the appropriate App Service category. Since this demo uses Windows App Service, select Azure App Service (Windows).

Select Azure App Service Windows

Select the target App Service from your account and click Finish.

Select existing App Service from account

A new publish profile is created in the solution. Click Publish to deploy.

Publish to Azure App Service from Visual Studio

After successful publishing, Visual Studio shows deployment success. You can open the site from the Open Site button or copied URL.

Publish succeeded message in Visual Studio

The deployed app now runs on your Azure App Service domain.

Application running on Azure domain

Conclusion

In this guide, we walked through creating an Azure App Service and deploying an ASP.NET MVC app using Visual Studio publish profiles. With this workflow, you can quickly host your app online and streamline your deployment process.