3

Azure Bites: Web Apps

Not got much time but want to learn Azure? Azure Bites takes you through key Azure concepts in Pomodoro sized bites.

Azure web apps provide a means to host your web applications without having to manually configure virtual machines, servers or IIS (phew).

Let’s create a new web app on Azure and upload our site to it.

In the Azure preview portal you can create a new web site (and anything else) by clicking the + New button.

From the list which appears select Web + Mobile, then Web App.

Creating a new web site

The preview portal utilises a panels layout, each time you click on an option, a new panel appears to the right.

Web site details

Now you need to put your thinking cap on and decide on the address for your new web app. For now it will be an azurewebsites.net address (you can change this later).

As you type into the App Service Name box, a green arrow will appear if your chosen name is available (and a red exclamation mark if not).

You will need to choose which subscription to add this app to.

Also at this point you can specify the resource group. Azure Resource Groups let you logically group your services. This makes it easier to manage them (you can focus in on a specific resource group) and also helps with deploying related resources (web sites, databases etc).

If you are happy with the default resource group use that, else you can click the New link and create a new one.

You can also choose a service plan/location. Again stick to the default or create/select a different one by clicking the right arrow.

Service Plan

Finally, click the Create button and let Azure work it’s magic.

On your dashboard you’ll see a new tile appear whilst your web site is created.

Deploying

Once it’s done, your web site’s settings may appear automatically, if not click on the name of your web app on the dashboard.

Running web site details

Click Browse to view your newly published web site (it will show a place-holder for now).

Now the most important part, deploying your site’s content! There are lot’s of ways to do this. You can deploy from Git, Mercurial or Dropbox. You can publish using Web Matrix or Visual Studio (including the community edition). Failing that you can use good old FTP, Powershell, MSBuild.

Obviously there are too many to cover in one post, for this example I’m going to use a Git repository hosted on GitHub.

In the settings panel on the right (if it’s not there, click on Settings) click on Continuous Deployment then Configure required settings.

Deploy to github part 1

Select GitHub and a new panel will appear, click on Configure required settings (under Authorization) and a shiny new Authorize button will appear.

Deploy to github part 2

Click that and you’ll be redirected to GitHub, click the Authorize Application button.

Deploy to github part 3

Now you’ve told GitHub you’re happy for Azure to access your account, you can choose which repository and branch you wish to deploy from.

Deploy to github part 4

When you’ve made your choices, click OK and Azure will set up your continuous deployment from GitHub to your Azure Web App.

Now all that’s left to do is push to your master branch on GitHub and your site will be deployed automatically.

Once you’ve pushed your changes, If you look at the Continuous Deployments panel in Azure for your web app, you will see your deployments listed.

Deployments

If you want to force a deployment from the latest commit on your chosen GitHub branch, just click Sync and a new deployment will start.