How to: Host your First Azure Web App

If you have never hosted a web site on Azure and need some guidance, you are at the right place. When you have a web application, you can host it in 3 different ways in Azure – as an Azure Web App, as an Azure Cloud Service or inside a Azure Virtual Machine. In this post, I am going to cover Azure Web App.

An Azure Web App is a fully managed environment available in Azure for hosting web sites and web applications quickly. Previously, this service was called as Azure Website. Now, it is part of the bigger offering called Azure app service.

In this post, I am going to show you how you can host your first web application in Azure. Before getting started, please note that I am using Visual Studio 2015 Update 3 for the demo. You should also have an active Azure subscription.

Here are the steps for hosting your first website as Azure Web App:

  1. Go to Visual Studio and create a new project. Chose Web and select ASP.Net web application. Give a name of your choice to the project. You can also chose to select Application Insights which is  a telemetry service. Then click OK:New project
  2.  Select MVC and leave the checkbox for Host in the cloud as unchecked. Then, click OK (If you are creating Azure Mobile app or Azure API app, these go under the same Azure App service, under which web apps are included:MVC
  3. Once your project is ready, build it and test it locally.WEbsite
  4. Go to Visual Studio and right click the project and click on Publish:Context Menu
  5. Ensure that you have logged into Visual Studio using the Live/Hotmail/Outlook ID linked to your azure subscription. It will automatically give you options to host the web app under your subscription.If you need help on how to do that, please refer this post. Once you click on Publish, the publish window opens up as below:Publish1
  6. Click on Microsoft Azure App Service, it will open up the following window:Publish2
  7. Select the appropriate subscription and click on New, if you would like to create a new app service. You can also choose from the list of existing app services from the list displayed.publish6
  8. Once your app service is ready, validate the Connection settings and click next:publish7
  9. Verify the app settings including the connection strings for your app service. In my demo, I dont need a connection string. Click on next:publish8
  10. On the preview tab, click on Publish to publish the web app in Azure as App Service: publish9
  11. Monitor the status of the Publish operation in the output window.Publish10.JPG
  12. Once it says, Publish succeeded, Visual Studio will automatically open the Azure hosted website in browser. If it doesn’t, copy the URL you have specified during publish process and paste it in the browser to access the website.publish12website
  13. Notice the URL of the website. It would be *.azurewebsites.net and your website is now hosted and accessible over Internet.
  14. Login into the Azure portal with your Live ID and you should be able to see a new Azure Web App created under your subscription.

Leave a Reply

Your email address will not be published. Required fields are marked *