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.
After Signing in the Azure portal, click on "New" from the left panel of the website as shown in the below image.
Now, click Web + Mobile >> Web App.
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.
We will get a notification message if the Deployment succeeds.
Now, click on "All resources" from the left panel of the website.
Click on the name of the newly-created app.
We can see all the details of our website. Now, click the "Get publish profile" to download the profile, as shown below.
Next, open Visual Studio and click New -> Project.
Select ASP.NET Web Application (.Net Framework), type the name as a FirstAzureWebsite in the name field, and click OK button.
Select MVC and click OK button as in the below image.
Now, we got the sample MVC application.
Right click on the project and click on "Publish…"
Select "Import" from the publishing target menu as shown in the below image.
Browse for the downloaded publish profile and click OK.
Now, we will see that our all required credentials are filled in the popup.
Click on "Validate Connection" for checking the connection details.
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.
Click on Next to check the Preview and click on "Start Preview" button to see all files which are going to the Azure.
We can clearly see all files in the below image. Now, click on "Publish" button.
Our website will be published on Azure and Visual Studio will automatically open the Website (hosted in 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.
Now, provide the right credential of your Azure account and select the app name followed by clicking on OK as in the below image.
We will get all the required credentials filled in the popup.
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.