Describe the bug
When using az containerapp registry set to add or update container registry credentials, the command unintentionally resets unrelated configuration properties in properties.configuration. Specifically, the runtime object (which contains .NET-specific settings like runtime.dotnet.autoConfigureDataProtection) is set to null after running the command.
This is a breaking side effect that disables critical .NET features like ASP.NET Core Data Protection for apps that scale to multiple replicas.
Command causing the issue
az containerapp registry set \
--name <app-name> \
--resource-group <resource-group> \
--server ghcr.io \
--username <username> \
--password <token>
Steps to reproduce
-
Create or use an existing Container App with .NET runtime configuration enabled (the "Development stack" setting in Azure Portal set to ".NET")
-
Verify the runtime configuration exists before the change:
az containerapp show --name <app> --resource-group <rg> --query "properties.configuration.runtime" --output json
Output before: {} or {"dotnet": {"autoConfigureDataProtection": true}}
- Run the registry set command:
az containerapp registry set \
--name <app> \
--resource-group <rg> \
--server ghcr.io \
--username MyUsername \
--password MyNewToken
- Check the runtime configuration again:
az containerapp show --name <app> --resource-group <rg> --query "properties.configuration.runtime" --output json
Output after: null (no output)
Expected behavior
az containerapp registry set should only modify registry-related properties (configuration.registries and the associated secret), preserving all other configuration properties like:
runtime (including .NET data protection settings)
ingress
dapr
- Any other unrelated configuration
Actual behavior
The command appears to perform a JSON Merge Patch on the configuration object that only includes the registries array. Properties not explicitly included in the patch payload (like runtime) are reset to null.
Impact
This bug has significant production impact:
- ASP.NET Core Data Protection is silently disabled - Apps using features like anti-forgery tokens, authentication, SignalR, Blazor Server, or session state will break when scaled to multiple replicas
- No warning or indication - The command completes successfully with no indication that other settings were modified
- Silent data loss - Configuration is lost without any way to recover it from the command output
Environment
- Azure CLI version: 2.75.0
- OS: macOS (Darwin 24.6.0)
- Shell: zsh
$ az --version
azure-cli 2.75.0
core 2.75.0
telemetry 1.1.0
Workaround
Instead of using az containerapp registry set, update only the secret value directly:
# Find the existing secret name referenced by the registry
az containerapp registry list --name <app> --resource-group <rg> --query "[].passwordSecretRef" --output tsv
# Update only the secret value (does not affect other configuration)
az containerapp secret set \
--name <app> \
--resource-group <rg> \
--secrets "<existing-secret-name>=<new-token-value>"
This approach updates the credential without touching any other configuration.
Suggested fix
The az containerapp registry set command should either:
- Read-modify-write pattern: Fetch the current configuration, merge only the registry changes, then write back the complete configuration
- Use a more targeted API: If the ARM API supports updating just the registries array without affecting other properties, use that
- Preserve existing properties: Ensure the PATCH payload includes all existing configuration properties, not just the ones being modified
Related
This affects the .NET on Azure Container Apps feature documented here:
https://learn.microsoft.com/en-us/azure/container-apps/dotnet-overview
The autoConfigureDataProtection setting is critical for .NET apps as described in the documentation:
"In .NET 8.0.4 and later, ASP.NET Core apps that use data protection are automatically configured to keep protected data accessible to all replicas as the application scales."
Describe the bug
When using
az containerapp registry setto add or update container registry credentials, the command unintentionally resets unrelated configuration properties inproperties.configuration. Specifically, theruntimeobject (which contains .NET-specific settings likeruntime.dotnet.autoConfigureDataProtection) is set tonullafter running the command.This is a breaking side effect that disables critical .NET features like ASP.NET Core Data Protection for apps that scale to multiple replicas.
Command causing the issue
Steps to reproduce
Create or use an existing Container App with .NET runtime configuration enabled (the "Development stack" setting in Azure Portal set to ".NET")
Verify the runtime configuration exists before the change:
Output before:
{}or{"dotnet": {"autoConfigureDataProtection": true}}Output after:
null(no output)Expected behavior
az containerapp registry setshould only modify registry-related properties (configuration.registriesand the associated secret), preserving all other configuration properties like:runtime(including .NET data protection settings)ingressdaprActual behavior
The command appears to perform a JSON Merge Patch on the
configurationobject that only includes theregistriesarray. Properties not explicitly included in the patch payload (likeruntime) are reset tonull.Impact
This bug has significant production impact:
Environment
Workaround
Instead of using
az containerapp registry set, update only the secret value directly:This approach updates the credential without touching any other configuration.
Suggested fix
The
az containerapp registry setcommand should either:Related
This affects the
.NET on Azure Container Appsfeature documented here:https://learn.microsoft.com/en-us/azure/container-apps/dotnet-overview
The
autoConfigureDataProtectionsetting is critical for .NET apps as described in the documentation: