Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Create and Deploy an ASP.NET Core Web App on Azure

DZone's Guide to

Create and Deploy an ASP.NET Core Web App on Azure

Let's take a look at how to deploy a simple ASP.NET Core web app to Microsoft's Azure cloud with some help from Visual Studio.

· Cloud Zone ·
Free Resource

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

Nowadays, most people are choosing a cloud platform as their hosting option. For Microsoft cloud lovers like me, that means we select Microsoft Azure as our hosting environment. That’s what this article is here to help with.

Before reading this article, you must read the articles below for the right ASP.NET Core knowledge.

Cloud Account

First, we need to create an account in the Azure Portal.

Azure Account Registration

1. Create an account in the Azure Portal through this link.

Domain Registration

We need to host our application on a particular domain.

  1. Click on “All resources” on the left-side menu. It will open a dashboard with an empty or already-existing list of resources that we created earlier.
  2. Click on the “Add” button. It will open another window with multiple options, and we can choose the appropriate option to host our application.
  3. As per our requirement, we choose “Web + Mobile” and click on the “Web App” on the right side.
  4. App Name Creation

    App Name Creation

  5. That will open another form for our app details to host. We need to give a unique name in the “Appname” section. It will create a subdomain for your ASP.NET Core application.

  6. For the subscription, we choose as “Free Trial” because we created a free account in the Azure Portal.

  7. We need to host our app resources in a Resource Group. First, we need to create a resource group name in our Azure account. Here, we choose the existing resource group name “AzureDemo” that we are already created in our Azure account.

  8. “OS” we selected as “Windows” (as per our requirement).

  9. We can create our own App Service Plan name.

  10. Application Insight will give you  more clarity about your hosted app (analytics, etc.)

  11. Click on the “Create” button and wait for the build to complete.

  12. Resource Group Name

    Resource Group Name

  13. Another way to create the Resource Group Name is to click on “Resource groups -> Add”

  14. Resource Group

    Resource Group

  15. Once the build succeeds, then we can see this output.

Build Succeeded

Simple Steps to Create an ASP.NET Core Application

  1. Open Visual Studio, then click on File > New > Project.
  2. Select Visual C# > Web > ASP.NET Core Web Application.
  3. Give the application a name like “MyFirstAzureWebApp”
  4. Then Click OK.
  5. Ctrl+F5

App Publishing

We created a default ASP.NET Core application (we had made some changes in the UI Section) for the publish process.

  1. Right-click on the application and click on the Publish menu.
  2. App Publishing

    App Publishing

  3. Click on the “Microsoft Azure App Service”

  4. We choose our existing resource group name (that we created! “AzureDemo”) in our Azure Portal. It will display the App Name inside the “AzureDemo” folder. This will display only when we log in through Visual Studio using Azure Credentials (email and password).

Resource Name

Resource Name

Output

The application is hosted in a given domain address http://menoth.azurewebsites.net/

Summary

We learned to create and deploy an ASP.NET Core web app in Azure. I hope this article is useful for all ASP.NET Core and Azure novices.

Reference

See Also

You can download other ASP.NET Core source code from MSDN Code using the link below.

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

Topics:
asp.net core ,azure ,web app ,cloud ,cloud deployment ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}