Create And Deploy Your First .NET Core App In Azure App Service

Azure Apps Service is a service provided by Microsoft Azure for hosting your web application, APIs, and mobile back-end. It helps you to quickly build, deploy, and scale enterprise-grade web, mobile, and API apps running on any platform

In this article, we will learn how to -

  • Create a sample .NET Core application in Visual Studio
  • Deploy the application to Azure
  • Update the application and redeploy the changes
  • Manage the application in Azure.

So, let’s get started with the steps.

Step 1

Create a new project in Visual Studio. I have selected ASP.NET Core Web Application as a template. Now, click "Next".
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 2
 
Configure your project with a valid name and location and click "Create".
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 3
 
As we want to create a .NET Core web application, we have selected Web Application. Click "Create".
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Now, we can see that our sample .NET Core application is ready.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 4
 
Run your application locally to see how it looks so that we can verify once it gets deployed to Azure.
 
Create and Deploy Your First .Net Core App in Azure App Service
Step 5
 
Now, go to your project in the Solution Explorer and click "Publish". Visual Studio will suggest different options to publish your code. As we are publishing into App Service, we need to select App Service >> Create New option and click "Publish".
 
Create and Deploy Your First .Net Core App in Azure App Service

Step 6 

This will take you to the screen where you can create your first Azure App Service. Here, create a new resource group and hosting plan. A resource group in Azure is a logical group into which resources like web apps, databases, and storage accounts are deployed and managed. If you delete the resource group, then everything inside it will get deleted automatically at once.

Also, log in with your Azure account so that it will create the app service inside your account.

Create and Deploy Your First .Net Core App in Azure App Service
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 8
 
After this, the screen will look like this. Finally, click "Create" so that it publishes your ASP.NET Core web application to Azure.

As soon as it publishes, it will launch the application in the default browser.

Create and Deploy Your First .Net Core App in Azure App Service
 
It publishes the ASP.NET Core web app to Azure and then launches the app in the default browser.

Step 9

You can also see the publishing activity in the window below.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 10
 
As we can see that publish is succeeded, now we can also copy the URL which is visible in the screenshot above and hit it to run the app.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Great! We can see that our application is now running inside the App Service in Azure.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 11
 
We can see that our application is running successfully. Now, it's time to do some changes and verify after redeploying to Azure.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 12
 
I have updated the text inside “index.cshtml” page. So before redeploying, let’s first verify the changes by running our app locally.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Clearly, our changes are working on local. Let’s redeploy it to Azure now.

Step 13

Now, go to the project in solution explorer. Right-click and select "Publish" and click the "Publish" button.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
Step 14
 
As we have already configured our Azure account, so directly clicking on "Publish" will publish our code to Azure.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
We can also verify this in the output window as shown above.

Step 15

Let's verify the changes now.
 
Create and Deploy Your First .Net Core App in Azure App Service
We can see that our changes are successfully deployed.
 
Step 16
 
Now, to manage our application, we can go to App Services and select our Web App. This will give you a complete overview of your application.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
We can also go to the Application Dashboard to have a more detailed overview.
 
Create and Deploy Your First .Net Core App in Azure App Service
 
So, there are lots of options that you can select and drill down for more information.
 

Summary

So far, we have seen how you can deploy your application in Azure using Azure App Service.

Besides App Service, there are also other options in Azure that can be used for hosting applications. For example, you can consider Service Fabric for microservice architecture. If you want to get more control, then you can use Azure Virtual Machines as well.

I hope you find this article helpful. Stay tuned for more … Cheers!