Scaling & Cost Guardrails
Cloud/DevOps runbook for manual Container App replica overrides, concurrency and KEDA scaling limits, and pausing non-production environments to control spend.
When to Use & Blast Radius
Use this runbook during planned traffic events, saturation incidents requiring immediate manual scale-out, or off-hours cost optimization in Development and Staging. Lowering minReplicas to 0 introduces cold-start latency; stopping non-production databases makes those environments unavailable until resumed.
Never set minReplicas to 0 or stop PostgreSQL Flexible Server in Production. Keep
minReplicas >= 1 for all production services and enforce maxReplicas caps to prevent runaway
autoscaling spend.
Pre-Flight Check
Inspect current replica counts and scaling bounds across all Container Apps in <RESOURCE_GROUP>:
az account set --subscription "<SUBSCRIPTION_ID>"az containerapp list --resource-group "<RESOURCE_GROUP>" \ --query "[].{Name:name, MinReplicas:properties.template.scale.minReplicas, MaxReplicas:properties.template.scale.maxReplicas, Status:properties.runningStatus}" \ -o tableProcedure
Apply a manual replica override during traffic spikes
Temporarily raise
min-replicasand capmax-replicason a saturated Container App (for example,gateway,ordering,catalog, orpresidio-analyzer):Terminal window az containerapp update \--name "<APP_NAME>" \--resource-group "<RESOURCE_GROUP>" \--min-replicas 3 \--max-replicas 10Configure HTTP concurrency scaling guardrails
Attach an HTTP scaling rule so replicas scale predictably under concurrent request load without exceeding
<MAX_REPLICAS>:Terminal window az containerapp update \--name "<APP_NAME>" \--resource-group "<RESOURCE_GROUP>" \--min-replicas 1 \--max-replicas 10 \--scale-rule-name http-concurrency \--scale-rule-type http \--scale-rule-http-concurrency 50Pause a non-production environment to stop compute spend
Stop non-production Container Apps and pause the PostgreSQL Flexible Server outside working hours:
Terminal window # Stop all Container Apps in a non-prod resource groupfor app in $(az containerapp list --resource-group "<RESOURCE_GROUP>" --query "[].name" -o tsv); doaz containerapp stop --name "${app}" --resource-group "<RESOURCE_GROUP>" --no-waitdone# Stop non-prod PostgreSQL Flexible Server (auto-restarts after 7 days per Azure policy)az postgres flexible-server stop --name "<POSTGRES_SERVER>" --resource-group "<RESOURCE_GROUP>"Resume a paused non-production environment
Start the PostgreSQL Flexible Server first, then start all Container Apps:
Terminal window az postgres flexible-server start --name "<POSTGRES_SERVER>" --resource-group "<RESOURCE_GROUP>"for app in $(az containerapp list --resource-group "<RESOURCE_GROUP>" --query "[].name" -o tsv); doaz containerapp start --name "${app}" --resource-group "<RESOURCE_GROUP>" --no-waitdone
Verification
Confirm updated replica limits and running state across <RESOURCE_GROUP>:
az containerapp list --resource-group "<RESOURCE_GROUP>" \ --query "[].{Name:name, MinReplicas:properties.template.scale.minReplicas, MaxReplicas:properties.template.scale.maxReplicas, Status:properties.runningStatus}" \ -o tableExpected output (active environment):
Name MinReplicas MaxReplicas Status--------- ------------- ------------- --------gateway 1 10 Runningordering 1 10 Runningcatalog 1 10 Running...Rollback / Escape Hatch
If a manual scale override or concurrency rule causes instability or unexpected cost, revert to baseline scaling bounds immediately:
az containerapp update \ --name "<APP_NAME>" \ --resource-group "<RESOURCE_GROUP>" \ --min-replicas 1 \ --max-replicas 5