Deploying a Web App in Azure
In this post, I will show you how to create a new web app using Azure App Services, the PaaS (Platform-as-a-Service) alternative to running web services on virtual machines.
Reusing an App Service Plan?
Azure web apps are web server instances that run on an app service plan; this app service plan is a collection of 1 or more load-balanced virtual machines that are managed for you by Azure. You don’t have to manage them in any way other than picking a size for them.
Depending on the scale of your web app and the spec of the app service plan, the app service plan can host more than 1 web app. For example, petri.com, thurrott.com, and aidanfinn.com could all be hosted on a single app service plan, thus sharing the cost and performance potential of the plan.
In the following example, I will be deploying a web app on a new app service plan. You will also see how an existing plan can be reused if this is desired.
Deploying the Web App
Log into the Azure Portal and Click New in the navigation bar on the left. Select Web + Mobile and then click See All. The Marketplace will open and be filtered for all of the web app options in Azure. There are many examples, such as a web app that will be co-deployed with an Azure SQL database, WordPress, and many more.
I will stick with a simple IIS instance, select Web App, and click Create.
The Web App – Create blade opens. Enter a name for the new web app; this must form a unique DNS name in the azurewebsites.net domain, for example, petri.azurewebsites.net. Either select an existing or create a new resource group to contain the resources for this web app. Choose if you want a Linux (Tomcat) or Windows (IIS) deployment. This will affect your choice/deployment of app service plans (Windows or Linux machines) in the next step.
Expand App Service Plan/Location and either select an existing app service plan or create a new one. I will create a new app service plan. If you choose to create a new plan, you have to name it, select a region/location, and choose a size.
Back in the Web App – Create blade, you can finish the process by opting to enable Application Insights or not; this enables code-level monitoring of your web app. Click Create to finish the process. Note that creating a new app service plan can slow down the process.
A few minutes later, the website is available on the Internet via http://petri.azurewebsites.net/. Subsequent steps can/might include:
- Assigning a custom domain name
- Setting up Application Settings, e.g. PHP/Java/Python/.Net Framework version, or a database connection string
- Configuring deployment slots
- Uploading code by FTP or via a deployment option
- Enabling backup
- Associating an SSL certificate
- Configuring the app service plan, e.g. auto-scaling