Question

Difficulty: MediumScale Azure App Service Web Apps

You manage a web application named EduLearn that is currently hosted on a Free (F1F1) App Service plan. During peak hours, the application experiences high CPU utilization and becomes slow. You want to implement an automated scaling solution to handle the load and ensure the application remains responsive, while also preventing autoscale flapping. You plan to configure these settings via the Azure CLI.

How should you order the steps to configure the autoscaling solution?

  1. 1Upgrade the App Service plan from F1F1 to Standard (S1S1) using the `az appservice plan update` command.
  2. 2Create an autoscale setting for the App Service plan using the `az monitor autoscale create` command, specifying the minimum, maximum, and default instance counts.
  3. 3Add a scale-out rule to the autoscale setting using the `az monitor autoscale rule create` command, targeting a CPU metric threshold of greater than 80%80\% over a 1010-minute duration.
  4. 4Add a scale-in rule to the autoscale setting using the `az monitor autoscale rule create` command, targeting a CPU metric threshold of less than 30%30\% over a 1010-minute duration to prevent flapping.

Answer

The correct sequence starts with upgrading the App Service plan to Standard (S1S1), creating the autoscale setting container, adding the scale-out rule, and finally adding the scale-in rule.
The correct order requires first scaling up the App Service plan from the Free (F1F1) tier to the Standard (S1S1) tier. Autoscaling is not supported on Free or Shared plans. Once upgraded, you must create the autoscale setting container using `az monitor autoscale create`. Only after the autoscale setting is created can you add specific rules to it. The scale-out rule (CPU > 80%80\%) should be added first to define the upper performance boundary, followed by the scale-in rule with a threshold of 30%30\%. Setting the scale-in threshold to 30%30\% (which is significantly lower than the scale-out threshold of 80%80\%) prevents autoscale flapping.

Step-by-Step Solution

1
Upgrade the hosting plan of the web app to Standard (S1S1).
The App Service plan is scaled up to a tier that supports custom autoscale settings.
Free (F1F1) and Basic (B1B1) plans do not support automatic scale-out; a Standard (S1S1) or Premium tier is required.
2
Create the custom autoscale setting container.
An autoscale profile with minimum, maximum, and default capacity is defined for the App Service plan.
Autoscale rules cannot be created without an existing autoscale setting to attach them to.
3
Define a scale-out rule with a CPU threshold of 80%80\%.
The application scales out by adding instances when under high CPU load.
Establishing the scale-out rule ensures that capacity increases when CPU utilization exceeds the threshold.
4
Define a scale-in rule with a CPU threshold of 30%30\%.
The application scales in by removing instances when CPU load decreases, without triggering flapping.
Setting the scale-in threshold sufficiently lower than the scale-out threshold prevents the application from repeatedly scaling in and out (flapping).

Key Concept

To configure autoscale on Azure App Service, the App Service plan must be scaled up to a supported tier (Standard or higher) before creating the autoscale setting and defining the scale-out and scale-in rules. To prevent autoscale flapping, the scale-in threshold must be significantly lower than the scale-out threshold.
Rate this question