Deploy Website To Azure Using Visual Studio

Introduction

This article demonstrates how to deploy a website to Azure using Visual Studio.

Prerequisites

First of all, login to the Azure portal. Click here to go to the Azure login page.

Azure

After Signing in the Azure portal, click on "New" from the left panel of the website as shown in the below image.

Azure

Now, click Web + Mobile >> Web App.

Azure

Enter the name of the App. Here, we are giving the name as vivek-kumar, so our website name will be vivek-kumar.azurewebsites.net.

Click on "Create" button.

Azure

We will get a notification message if the Deployment succeeds.

Azure

Now, click on "All resources" from the left panel of the website.

Azure

Click on the name of the newly-created app.

Azure
We can see all the details of our website. Now, click the "Get publish profile" to download the profile, as shown below.

Azure

Next, open Visual Studio and click New -> Project. 

Azure

Select ASP.NET Web Application (.Net Framework), type the name as a FirstAzureWebsite in the name field, and click OK button.

Azure

Select MVC and click OK button as in the below image.

Azure

Now, we got the sample MVC application.

Azure

Right click on the project and click on "Publish…"

Azure

Select "Import" from the publishing target menu as shown in the below image.

Azure

Browse for the downloaded publish profile and click OK. 

Azure

Now, we will see that our all required credentials are filled in the popup.

Azure

Click on "Validate Connection" for checking the connection details.

Azure

Click on Next.

Note - If we want to configure Database, then we can configure that here in the Settings tab but as per our sample application, we are not going for any database operation, so just click on "Next" button.

Azure

Click on Next to check the Preview and click on "Start Preview" button to see all files which are going to the Azure.

Azure

We can clearly see all files in the below image. Now, click on "Publish" button.

Azure

Our website will be published on Azure and Visual Studio will automatically open the Website (hosted in Azure).

Azure

We can also choose the Microsoft Azure App Service from the publish target menu while publishing from Visual Studio, as shown in the below image.

Azure

Now, provide the right credential of your Azure account and select the app name followed by  clicking on OK as in the below image.
Azure

We will get all the required credentials filled in the popup.

Azure
 
 
Now we can publish the website to Azure
 

Summary

In this article, we have covered two ways (Microsoft Azure App Service and Import) for publishing the website on Azure using Visual Studio.