OpsCanary
azurecontainer appsPractitioner

Mastering Scaling Rules in Azure Container Apps

5 min read Microsoft LearnApr 26, 2026Reviewed for accuracy
Share
PractitionerHands-on experience recommended

Scaling rules in Azure Container Apps exist to help you manage your application’s performance and resource utilization effectively. They allow your container apps to automatically adjust the number of active replicas based on real-time demand, which is essential for maintaining responsiveness while controlling costs. This automatic scaling is driven by a combination of limits, rules, and behavior, ensuring that your application can handle traffic spikes without manual intervention.

Azure Container Apps utilizes KEDA (Kubernetes Event-driven Autoscaling) to support scaling based on various metrics, including HTTP requests and TCP connections. You can define minimum and maximum replicas for your application, with defaults set to 0 and 1000, respectively. For instance, you can configure an HTTP scaling rule that triggers additional replicas when concurrent requests exceed a specified threshold. This is done using parameters like --scale-rule-http-concurrency to set the concurrency level that should trigger scaling actions. The same applies to TCP connections, allowing you to tailor your scaling strategy based on your application’s specific needs.

In production, you need to be aware of several important factors. First, you won't incur charges when your container app scales down to zero, which is a significant cost-saving feature. However, be cautious during platform upgrades or maintenance, as you might temporarily see more replicas than expected. Additionally, scaling rules for Container Apps jobs are limited; they don't support HTTP or TCP scaling rules, which could impact your design choices. Always configure scaling rules using the Azure CLI, Azure Resource Manager, or Bicep, as the Azure portal does not support TCP scaling rule configuration.

Key takeaways

  • Define min and max replicas to control scaling behavior effectively.
  • Utilize KEDA for scaling based on HTTP requests, TCP connections, and other metrics.
  • Monitor for unexpected replicas during platform upgrades or maintenance.
  • Remember that scaling to zero incurs no charges, optimizing costs.
  • Use Azure CLI or Bicep for configuring TCP scaling rules.

Why it matters

Properly configured scaling rules can significantly enhance application performance and reduce costs by ensuring resources are only used when necessary. This is especially critical in environments with fluctuating workloads.

Code examples

Bicep
1resource symbolicname 'Microsoft.App/containerApps@2025-02-02-preview' = {
2  ...
3  properties: {
4    ...
5    template: {
6      ...
7      scale: {
8        maxReplicas: 0
9        minReplicas: 5
10        rules: [
11            name: 'http-rule'
12            http: {
13              metadata: {
14                concurrentRequests: '100'
15
CLI
1az containerapp create \
2  --name <CONTAINER_APP_NAME> \
3  --resource-group <RESOURCE_GROUP> \
4  --environment <ENVIRONMENT_NAME> \
5  --image <CONTAINER_IMAGE_LOCATION>
6  --min-replicas 0 \
7  --max-replicas 5 \
8  --scale-rule-name azure-http-rule \
9  --scale-rule-type http \
10  --scale-rule-http-concurrency 100
Bicep
1resource symbolicname 'Microsoft.App/containerApps@2025-02-02-preview' = {
2  ...
3  properties: {
4    ...
5    template: {
6      ...
7      scale: {
8        maxReplicas: 0
9        minReplicas: 5,
10        rules: [{
11            name: 'tcp-rule'
12            http: {
13              metadata: {
14                concurrentConnections: '100'
15

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →
DigitalOceanSponsor

Simple, affordable cloud — VMs, Kubernetes, and managed databases in minutes. Trusted by 600,000+ developers. Spin up a Droplet in 60 seconds.

Try DigitalOcean →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.