0
0
AzureHow-ToBeginner · 3 min read

How to Scale Azure App Service: Simple Steps to Increase Capacity

To scale an Azure App Service, you can either increase the number of instances (scale out) or upgrade the service plan to a higher tier (scale up). Use the Azure Portal or Azure CLI commands like az appservice plan update --number-of-workers to adjust instance count and az appservice plan update --sku to change the pricing tier.
📐

Syntax

Scaling an Azure App Service involves two main actions:

  • Scale out: Increase or decrease the number of instances running your app.
  • Scale up: Change the App Service plan to a higher or lower pricing tier with more resources.

Using Azure CLI, the commands are:

  • az appservice plan update --name <plan-name> --resource-group <group-name> --number-of-workers <count> to scale out.
  • az appservice plan update --name <plan-name> --resource-group <group-name> --sku <sku-name> to scale up.
bash
az appservice plan update --name MyPlan --resource-group MyResourceGroup --number-of-workers 3
az appservice plan update --name MyPlan --resource-group MyResourceGroup --sku P1v3
💻

Example

This example shows how to scale out an App Service plan to 3 instances and then scale up to the Premium P1v3 tier using Azure CLI.

bash
az appservice plan update --name MyAppServicePlan --resource-group MyResourceGroup --number-of-workers 3
az appservice plan update --name MyAppServicePlan --resource-group MyResourceGroup --sku P1v3
Output
Updated App Service plan 'MyAppServicePlan' with 3 instances. Updated App Service plan 'MyAppServicePlan' to SKU 'P1v3'.
⚠️

Common Pitfalls

Common mistakes when scaling App Service include:

  • Trying to scale out on a Free or Shared tier, which does not support multiple instances.
  • Not checking if the App Service plan supports the desired SKU before scaling up.
  • Forgetting to update the resource group or plan name correctly in commands.
  • Assuming scaling changes are instant; it may take a few minutes to apply.
bash
## Wrong: Trying to scale out on Free tier
az appservice plan update --name MyPlan --resource-group MyGroup --number-of-workers 2

## Right: Use Basic or higher tier before scaling out
az appservice plan update --name MyPlan --resource-group MyGroup --sku B1
az appservice plan update --name MyPlan --resource-group MyGroup --number-of-workers 2
📊

Quick Reference

ActionCommand ExampleNotes
Scale out (increase instances)az appservice plan update --name MyPlan --resource-group MyGroup --number-of-workers 3Requires Basic tier or higher
Scale up (change pricing tier)az appservice plan update --name MyPlan --resource-group MyGroup --sku P1v3Upgrades resources like CPU and memory
Check current scale settingsaz appservice plan show --name MyPlan --resource-group MyGroupShows current instance count and SKU
Scale out on Free tierNot supportedMust upgrade plan first

Key Takeaways

Scale out by increasing instance count to handle more traffic.
Scale up by changing the App Service plan SKU for more resources.
Free and Shared tiers do not support scaling out; upgrade first.
Use Azure CLI or Portal to manage scaling easily.
Scaling changes may take a few minutes to apply.