Getting started with Azure for Scalability and Availability

On June 27th, my colleague Niall and I ran a hands on workshop for some startups we’re working with from the NDRC. Below is a walkthrough of what we covered and you can try it yourself too!

If you follow this post, you’ll learn how to:

  • Create Resource Groups
  • Create Web Apps
  • Enable auto-scale in your app service
  • Set your deployment credentials
  • Connect to and Deploy from GitHub
  • Pointing domains, setting alerts and submitting support requests

Create Resource Group

The first thing we’ll do is create a Resource group in our portal. This will allow us to logically group our resources together.

  • Click New
  • In the search box, type Resource Group
  • Click Create - Give it a name
  • Choose the subscription
  • Choose a location
  • Click create

If you select to pin the resource group to the dashboard, you’ll have quick and easy access to it when you enter your portal next time.

1resourcegroup

Create web app inside the resource group

  • Either click the resource groups link on the left, or select the Resource group from the home screen.
  • Click Add
  • Search for, or scroll down and select Web App
  • Click Create- Name it
  • Subscription and Resource group should auto populate
  • Click to create a new App service plan - Click Create New
  • Give it a name
  • Choose a location
  • Choose S1 standard as the pricing tier
  • Click Ok
  • Wait for the app to be deployed

2addapp

3addapp

Find your Resource Group and see what’s inside

  • Click resource groups or select from home screen if you pinned it there
  • You’ll see a few things deployed: - Application insights
  • App service plan
  • App service
  • Click on the App service, and then the URL to launch your live site. You’ll see a placeholder there.

4resourcegroup

Enable auto-scale in App service

Next, we’re going to enable auto-scale for our app service. We’re basically creating a set of rules to increase or decrease the number of instances based on CPU utilization at a given time. There’s a great blog post with a bunchmore detail on this here if you’d like to read further.

  • From within your Resource Group, Click on app service plan - 5appserviceplan
  • In the settings pane, scroll down to where it says Scale Up and Scale Out - Scale up – enables you to upgrade or downgrade the App service plan
  • 6scale
  • Click scale out - Select from the dropdown: schedule and performance rules
  • Click Add Profile - Name it: ScaleProfile
  • Leave target range as 1-10
  • Click OK
  • 7scale
  • Click Add Rule - CPU Percentage Increase (RULE 1) – If the CPU utilization averagegoes over 80% for a duration of 10 minutes, spin up an additional instance. - Choose Metric name, CPU Percentage
  • Operator: Greater than
  • Threshold: 80%
  • Duration: 10 minutes
  • Time agg: Avg
  • Action: increase count by 1
  • Cool down: 5 minutes
  • 8scale
  • CPU Percentage Decrease (RULE 2) – If the CPU utilization average drops below 60% for a duration of 10 minutes, spin down a resource. - Choose Metric name, CPU Percentage
  • Operator: Less than
  • Threshold: 60%
  • Duration: 10 minutes
  • Time agg: Avg
  • Action: decrease count by 1
  • Cool down: 5 minutes
  • 9scale
  • At this stage you can set up email notifications or webhooks to notify you when changes occur. (Check out Azure Logic Apps or Zapier for creating custom workflows from webhooks)
  • 10scale
  • Click the save icon in the top corner when you’re finished adding the rules.

[Optional] Set FTP Deployment credentials

  • Click on the App service - 11appservice
  • You’ll see that there’s an FTP Hostname, but no deployment user set
  • Click Settings
  • Scroll down and find deployment credentials- 12deploy
  • Set a Username and password to deploy from Git and/or FTP, then click Save

[Optional] Connect to and deploy from GitHub

I’ve included this to just quickly show the functionality here. There’s a great post here with a lot more detail if you’re interested in learning how to deploy from repository sites.

  • Click on the App service11appservice
  • Click Settings
  • Scroll down and find Deployment source 13deploysource
  • Choose which deployment source you’d like to go with. For the demo, I linked to my GitHub project, HelloAzureWeb, which just has an index.html file in it. - Click configure required settings and then Authorize Azure to access your GitHub account
  • Click Ok
  • Choose a project – HelloAzureWeb
  • Choose a branch – master
  • You can also set up a performance test to run after each deployment if you want.
  • Click Ok
  • Go to GitHub and make a change to the html file, then commit to the master branch
  • Go back to your website where the placeholder was, and you should see that it’s been updated!

Some final notes and things to check out

  • To add additional alerts, go into your app service plan and click settings. From there you’ll see the option to add Alerts.
  • To submit a support request to the Azure team, click the question mark icon in the top of your portal and select “New Support Request” 14support

For the second half of the session, Niall talked about getting started with Infrastructure Services on Azure. He’s written his own blog post on that and you can find it here.

Leave me a comment below to let me know how you get on and if you have any questions!