Skip to content

maxReplicas in YAML file not respected #32061

@chrisdeely

Description

@chrisdeely

Describe the bug

I am using a YAML file to create/update a container app with the az containerapp create command. I have defined a scale configuration as below:

properties:
  template:
    scale:
      minReplicas: 1
      maxReplicas: 1

(While unconventional, my goal is to have exactly 1 replica of this container)

The az containerapp create command validates the YAML file & completes the transaction successfully, however the maxReplicas value is ignored.

In the command output, I can see that internally the YAML was translated to ARM and the scale section incorrectly lists maxReplicas as 10:

"scale": {
        "cooldownPeriod": 300,
        "maxReplicas": 10,
        "minReplicas": 1,
        "pollingInterval": 30,
        "rules": null
      }

Related command

az containerapp create --name ${NAME_LABEL} --resource-group ${AZURE_RESOURCE_GROUP} --yaml ${YAML_FILE}

Errors

No errors, the transaction completes & creates or updates the container app

Issue script & Debug output

Both the outbound request and response body to PUT https://management.azure.com/subscriptions/SUBSCRIPTION/resourceGroups/RESOURCE_GROUP/providers/Microsoft.App/containerApps/APP_NAME show maxReplicas: null

cli.azure.cli.core.util: Request URL: 'https://management.azure.com/subscriptions/SUBSCRIPTION/resourceGroups/RESOURCE_GROUP/providers/Microsoft.App/containerApps/APP_NAME?api-version=2025-01-01'
cli.azure.cli.core.util: Request method: 'PUT'
cli.azure.cli.core.util: Request headers:
cli.azure.cli.core.util:     'User-Agent': 'python/3.13.7 (macOS-15.6.1-arm64-arm-64bit-Mach-O) AZURECLI/2.77.0 (HOMEBREW)'
cli.azure.cli.core.util:     'Accept-Encoding': 'gzip, deflate'
cli.azure.cli.core.util:     'Accept': '*/*'
cli.azure.cli.core.util:     'Connection': 'keep-alive'
cli.azure.cli.core.util:     'x-ms-client-request-id': 'req'
cli.azure.cli.core.util:     'Content-Type': 'application/json'
cli.azure.cli.core.util:     'CommandName': 'containerapp create'
cli.azure.cli.core.util:     'ParameterSetName': '--debug --name --resource-group --yaml'
cli.azure.cli.core.util:     'Authorization': 'Bearer ......'
cli.azure.cli.core.util:     'Content-Length': '3404'
cli.azure.cli.core.util: Request body:
cli.azure.cli.core.util: {"scale": {"minReplicas": 1, "maxReplicas": null, "cooldownPeriod": null, "pollingInterval": null, "rules": null}, 
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions/SUBSCRIPTION/resourceGroups/RESOURCE_GROUP/providers/Microsoft.App/containerApps/APP_NAME?api-version=2025-01-01 HTTP/1.1" 201 4229
cli.azure.cli.core.util: Response status: 201
cli.azure.cli.core.util: Response headers:
cli.azure.cli.core.util:     'Cache-Control': 'no-cache'
cli.azure.cli.core.util:     'Pragma': 'no-cache'
cli.azure.cli.core.util:     'Content-Length': '4229'
cli.azure.cli.core.util:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.util:     'Expires': '-1'
cli.azure.cli.core.util:     'Retry-After': '15'
cli.azure.cli.core.util:     'x-ms-async-operation-timeout': 'PT15M'
cli.azure.cli.core.util:     'api-supported-versions': '2022-03-01, 2022-06-01-preview, 2022-10-01, 2022-11-01-preview, 2023-04-01-preview, 2023-05-01, 2023-05-02-preview, 2023-08-01-preview, 2023-11-02-preview, 2024-02-02-preview, 2024-03-01, 2024-08-02-preview, 2024-10-02-preview, 2025-01-01, 2025-02-02-preview, 2025-07-01, 2025-10-02-preview'
cli.azure.cli.core.util:     'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.util:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.util:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.util:     'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.util:     'Date': 'Thu, 04 Sep 2025 16:16:02 GMT'
cli.azure.cli.core.util: Response content:
cli.azure.cli.core.util: {"id":"/subscriptions/SUBSCRIPTION/resourceGroups/RESOURCE_GROUP/providers/Microsoft.App/containerapps/APP_NAME","name":"APP_NAME","type":"Microsoft.App/containerApps","scale":{"minReplicas":1,"maxReplicas":null,"cooldownPeriod":null,"pollingInterval":null,"rules":null},

Expected behavior

The scale rule's maxReplicas should match what was defined in the YAML config

Environment Summary

az -v
azure-cli 2.77.0

core 2.77.0
telemetry 1.1.0

Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0

Additional context

If there is an explicit rule against setting maxReplicas: 1 I cannot find any such documentation, and the CLI should throw a validation error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botContainerAppService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions