Configure scaling for an App Service plan

Create and configure Azure App Service

📘Microsoft Certified: Azure Administrator Associate (AZ-104)


Scaling is one of the most important features of Azure App Service. It helps your web applications, APIs, or backend services handle changes in workload without downtime and with the right amount of resources.

In Azure App Service, scaling happens at the App Service plan level, not at the individual app level. This means the compute resources you scale (CPU, RAM, instance count) apply to all apps inside that App Service plan.


1. What is Scaling in Azure App Service?

Scaling allows your application to adjust compute resources based on demand.

There are two main types:

1.1 Vertical Scaling (Scale Up)

Increasing the size of your App Service plan by choosing a higher pricing tier with more CPU, RAM, and features.

1.2 Horizontal Scaling (Scale Out)

Increasing the number of instances of your App Service plan (e.g., from 1 VM to 5 VMs).


2. Vertical Scaling (Scale Up)

Vertical scaling means your App Service plan uses a more powerful machine.

Reasons to use Scale Up

  • If your app needs more CPU or memory.
  • If your app requires features available only in higher tiers (e.g., custom domains, autoscaling, staging slots).
  • If your performance monitoring shows your VM is overloaded.

How to Scale Up

You can scale up using:

  • Azure Portal
  • Azure CLI
  • Azure PowerShell
  • ARM templates / Bicep

In Azure Portal:

  1. Open App Service plan.
  2. Select Scale up (App Service plan).
  3. Choose the new pricing tier (e.g., from B1 → P1v3).
  4. Click Apply.

Key Pricing Tiers (Important for Exam)

TierDescriptionFeatures
Free (F1)Shared CPULimited; no custom domains
Shared (D1)Shared CPUBasic features
Basic (B1-B3)Dedicated VMNo autoscaling
Standard (S1-S3)Dedicated VMAutoscale available
Premium (P1v3-P3v3)High-performanceAdvanced scaling, VNET integration
Isolated (I1-I3)Private environmentFor high-security workloads

Exam Tip:
Autoscaling is only available in Standard tier and above.


3. Horizontal Scaling (Scale Out)

Scale-out increases the number of VM instances running your app.

Scaling out helps when:

  • App traffic increases (e.g., more users).
  • CPU or memory usage becomes high.
  • You need redundancy across multiple instances.

Two ways to Scale Out:

  1. Manual Scale Out
  2. Automatic Scale Out (Autoscale)

4. Manual Scale-Out

You manually choose how many instances you want (e.g., 1 → 3 instances).

This is useful when:

  • You expect a predictable increase in traffic (e.g., scheduled business operations).
  • You prefer full control over instance count.

Steps in Azure Portal:

  1. Go to App Service plan.
  2. Select Scale out (App Service plan).
  3. Choose Manual.
  4. Set the instance count.
  5. Click Apply.

5. Automatic Scaling (Autoscale)

Autoscaling adjusts the number of instances automatically based on rules.

This keeps your app responsive without overspending.

Autoscale works based on:

  • Metrics
  • Schedules
  • Custom rules

Common Metrics Used for Autoscale

  • CPU percentage
  • Memory percentage
  • HTTP request count
  • Data in / data out
  • Custom metrics from Application Insights

6. Configuring Autoscale: Key Components

Autoscaling configuration uses three elements:

6.1 Autoscale Setting

This is the container for all autoscale rules.
You can have multiple autoscale profiles.

6.2 Autoscale Profiles

Profiles define when certain rules apply.

There are two types:

a. Default profile

Applies when no other profiles match.

b. Scheduled profile

Applies during specific times (e.g., business hours).

Useful in IT operations:

  • Higher traffic expected 9 AM–5 PM → add more instances
  • Lower traffic at night → reduce instances to save cost

6.3 Autoscale Rules

Rules define how and when Azure should scale.

A rule contains:

  • Metric (e.g., CPU > 75%)
  • Time window (e.g., average over 10 minutes)
  • Action (scale out +1 instance)

7. How to Configure Autoscale in Azure Portal

  1. Open App Service plan.
  2. Select Scale out (App Service plan).
  3. Choose Custom autoscale.
  4. Set:
    • Minimum instance count
    • Maximum instance count
    • Default instance count
  5. Add autoscale rules such as:
    • If CPU > 70% for 10 mins → scale out by 1 instance
    • If CPU < 40% for 10 mins → scale in by 1 instance

8. Autoscale Rule Examples (Exam-Helpful)

Example 1: Scale Out Rule

  • Metric: CPU percentage
  • Condition: CPU > 75%
  • Duration: 10 minutes
  • Action: Add 1 instance

Example 2: Scale In Rule

  • Metric: CPU percentage
  • Condition: CPU < 40%
  • Duration: 10 minutes
  • Action: Remove 1 instance

Example 3: Schedule-Based Scaling

  • 9 AM – 6 PM (work hours): minimum 3 instances
  • After 6 PM: minimum 1 instance

This is useful for internal corporate applications with predictable usage patterns.


9. Autoscale Best Practices for AZ-104 Exam

1. Always define a maximum instance count

This protects you from cost overruns.

2. Do not scale too quickly

Use longer time windows to avoid unnecessary scale actions.

3. Set cool-down periods (Default: 5 minutes)

Prevents rapid scale in/out actions.

4. Use Application Insights metrics for better autoscale accuracy

Example: autoscale based on queue length, dependency calls, or response time.

5. Choose the right pricing tier

Autoscale only works in Standard, Premium, and Isolated tiers.

6. Separate workloads into different App Service plans

So each app scales independently.


10. Scaling Using Azure CLI (Exam-Relevant)

Scale Up Example

az appservice plan update \
  --name MyPlan \
  --resource-group MyRG \
  --sku S2

Manual Scale Out Example

az appservice plan update \
  --name MyPlan \
  --resource-group MyRG \
  --number-of-workers 3

11. Scaling Using ARM/Bicep Templates

You can specify instance count and SKU in templates, helpful for IaC (Infrastructure as Code).

Template Snippet

"sku": {
   "name": "S2",
   "capacity": 3
}

12. Common Exam Questions to Expect

Here are common question patterns AZ-104 uses:

Q1: An app experiences high CPU usage. What should you configure?

✔ Configure CPU-based autoscale rule.

Q2: Autoscale is not available. Why?

✔ The App Service plan is using Basic tier, which does not support autoscaling.

Q3: You want to schedule scaling during business hours only. What do you use?

Autoscale profiles with schedules.

Q4: You want to increase RAM available to the app. What do you configure?

Scale up the App Service plan.

Q5: You want more instances of the app. What should you do?

Scale out.


Final Summary (For Your Website)

Scaling in Azure App Service ensures your applications perform well, stay available, and use resources efficiently.

Scale Up = choose a more powerful App Service plan
Scale Out = increase the number of instances
Autoscale = automatically scale based on metrics or schedules
✔ Requires Standard or higher tiers
✔ Configure autoscale using metrics like CPU, memory, request count
✔ Use autoscale profiles and rules to define behavior

This knowledge is essential for the AZ-104 exam and practical real-world Azure administration.

Leave a Reply

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

Buy Me a Coffee