Create And Deploy An ASP.NET Core Web App In Azure

Introduction 
 
Nowadays, most people are choosing web hosting on a cloud platform. Microsoft lovers like us basically select "Microsoft Azure" as our hosting environment.That’s the reason I have written this new article defining a simple way of hosting in Azure.
 
Before reading this article, you must read the articles given below for ASP.NET Core knowledge.
Azure Account
 
First, we need to create an account on the Azure portal. Only then can we host the application in the cloud environment. So, please check the following steps to create an Azure account.
 
Azure Account Registration 
 
Create an account through this link to Azure Portal.
 
Domain Registration
 
We need to host our application in a particular domain. Check the following steps -
  1. Click on "All resources" on the left side menu and it will open a dashboard with an empty or already existing list of resources that we have created earlier.

  2. Click on the "Add" button and it will open another window with multiple options. We can choose an appropriate option to host our application.

  3. As per our requirement, we choose "Web + Mobile" and clicked on the "Web App" on the right side.

  4. It will open another form to fill up our app details to host. We need to give a unique name in the "Appname" section and It will create a subdomain for our ASP.NET Core application.

  5. We choose subscription as "Free Trial" because we created a free account on the Azure portal.

  6. We need to host our app resources in Resource group, So first we need to create a resource group name in our Azure account. But we choose existing resource group name "AzureDemo" that we are already created in our Azure account.

  7. "OS ( Operating System )" we selected as "Windows"( As per our requirement ).

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

  9. Application Insight will give you the more clarity about your hosted app. Eg. analytics, etc.

  10. Click on the “Create” button and wait for the build success.



  11. Another way to create the Resource Group Name - click on "Resource groups -> Add".

     

  12. Once the build is succeeded, then we can see this output.

     
Simple steps to create an Asp.Net Core Application
  1. Open our VisualStudio then click on File > New > Project.
  2. Select Visual C# > Web > ASP.NET Core Web Application.
  3. We have given our application name as "MyFirstAzureWebApp".
  4. Then, click OK.
  5. Click on the "Ctrl+F5".
App Publishing into Azure
 
We created a default ASP.NET Core application ( We have done some changes in UI Section) for the publishing process.
  1. Right click on the application and click on the Publish menu.



  2. Click on the "Microsoft Azure App Service".



  3. We choose our existing resource group name ( That we created ! "AzureDemo" ) in our Azure Portal and It will display the App Name inside the "AzureDemo" folder. This will display only when we are login through the Visual Studio using Azure credentials ( Email & Password).

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

Reference
See Also
 
You can download other ASP.NET Core source codes from MSDN Code, using the link, mentioned below.
Summary
 
We learned how to create and deploy an ASP.NET Core web app in Azure. I hope this article is useful for all ASP.NET Core & Azure beginners. 


Similar Articles