highIntermediateRED#app-service#recycle#always-on#scale-out#worker

App Service frequent recycling — Always On disabled or scale-out thrash

App recycles every few minutes with no code change

Likely source:availabilityscaling

Focused incident mode — strips away everything but this runbook.

Symptoms

  • App recycles every few minutes with no code change
  • HTTP 503 intermittent, especially after idle
  • Worker process restarts with no OOM in the logs

Always On is unavailable on Free and Basic tiers. If your app recycles every few minutes, the first check should always be the tier and Always On setting.

Evidence to grab

Collect these artifacts before you change anything — they prove (or rule out) each cause.

  • Always On setting

    az webapp config show --name <APP> --resource-group <RG> --query alwaysOn -o tsv
  • App Service plan tier

    az appservice plan show --name <PLAN> --resource-group <RG> --query "{tier:sku.tier,capacity:sku.capacity}" -o json

Diagnostic flow

Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.

Guided decision tree is ready.

Steps with commands, expected output, and pass/fail branches.

Ranked root causes

Evidence checklist

  • az webapp config show returns alwaysOn = false
  • Recycle happens after idle period, not under load

Confirm before fixing

az webapp config show --name <APP> --resource-group <RG> --query alwaysOn -o tsv
READ

Confirm Always On setting

Fix

az webapp config set --name <APP> --resource-group <RG> --always-on true
CHANGE

Enable Always On (requires Standard tier+)

Expected: Successfully updated App Service settings

Resolution runbook

Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.

1
az webapp config show --name <APP> --resource-group <RG> --query alwaysOn -o tsv
READ

Check Always On status

2
az appservice plan show --name <PLAN> --resource-group <RG> --query "{tier:sku.tier,capacity:sku.capacity}" -o json
READ

Review the plan tier

3
az webapp config set --name <APP> --resource-group <RG> --always-on true
CHANGE

Enable Always On

4
az appservice plan update --name <PLAN> --resource-group <RG> --sku S1
CHANGE

Upgrade to Standard tier if currently Free or Basic

Prevention

  • Enable Always On on all production App Service plans.
  • Use Standard tier or higher for production workloads.
  • Set autoscale rules with a 5-minute cooldown to prevent thrashing.
  • Monitor CurrentInstanceCount and HttpQueueLength for scale stability.

Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.