Blog

Intro

This article demonstrates how to create an App Service in Azure and deploy an ASP.Net Core application through Visual Studio. You will need to have the following tools to follow along with this artile.

  • Azure Subscription - I am currently using my free MPN subscription which I get €130 credits free per month
  • Visual Studio - IDE which you can download from here

First open Visual Studio and create a new project, select ASP.Net Core Web Application as the project type, give the project a name, I have named this azure-app-service-demo. Click ok, select web Application (Model-View-Controller) as the template. Visual Studio will generate the web application and you should have a folder structure similar to below.

Project Template Project Template
Folder Structure Folder Structure

Run the application to make sure it runs without error, once it compiles and starts you should see a screen similar to below.

application Application

Next navigate to the Azure portal here and from the dashboard, type App Service in the search box, select App Services and create a new app service.

App Service Search App Service
App Service New New App Service

In the create app service screen enter the details as below and click create.

  • Subscription - Select your Azure subscription
  • Resource Group - Is a logical group of resources
  • Name - The name of your web application
  • Publish - Inticates if you are deploying code or in to a Docker Container
  • Runtime Stack - Select the same runtime as your application in this case .NET Core 3.1
  • Operating System - Select Windows
  • Region - Select North Europe or wherever you are located

Create Azure App Service Create App Service

Once your resources have been deployed, navigate to your app service and download the publish profile as shown below.

Publist Profile Publish Profile

Now you are ready to deploy your web application to your App Service, go back to Visual Studio, right click on you project, select publish. You will see a screen as below, select import profile then select Web Deploy from the dropdown list, now click publish.

Publish Service Search Import Publish Profile
Web Deploy Web Deploy Publish

After a minute or two your application will be automatically deployed to your Azure App Service as shown below

Deployed App Service

When you are done with your App Service, Azure makes it easy for you to clean up your resources. Navigate to the Azure portal, select the resource group you created at the start of this article and click delete resource group. Azure will ask you to enter in the name as confirmation before you can delete. Enter in the name and select delete and your resources will be deleted.

Deployed App Service

Conclusion

In this article I demonstrated how easy it is to create a web project through visual studio and deploy it to an Azure App Service in just a few minutes. If something is not clear and you would like me to explain it a bit better, feel free to leave a comment below and I will get back to you as soon as I can.