Skip to content

[Container App] Fix managed identity resource ID corrupted by camelCase normalization when using --yaml#33350

Draft
Copilot wants to merge 2 commits into
devfrom
copilot/fix-managed-identity-id-issue
Draft

[Container App] Fix managed identity resource ID corrupted by camelCase normalization when using --yaml#33350
Copilot wants to merge 2 commits into
devfrom
copilot/fix-managed-identity-id-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

Related command
az containerapp create --yaml

Description

When --yaml specifies identity.userAssignedIdentities with ARM resource ID keys containing underscores (e.g. resource groups named MY_RG_NAME), the CLI corrupts those keys by applying camelCase normalization — MY_RG_NAME becomes MyRgName — causing ARM to reject the request with LinkedAuthorizationFailed.

Root cause: _convert_object_from_snake_to_camel_case blindly converts all dict keys. When it reaches the userAssignedIdentities dict, the ARM resource ID strings used as keys get camelCased alongside legitimate snake_case property names.

Fix:

  • _utils.py: Skip camelCase conversion for keys starting with / (ARM resource IDs are always absolute paths). One-line guard added to _convert_object_from_snake_to_camel_case.
# Before
_to_camel_case(a): ...

# After — ARM resource ID keys are preserved verbatim
(_to_camel_case(a) if not a.startswith('/') else a): ...
  • test_containerapp_utils.py: Unit test added to assert ARM resource ID keys with underscores survive the conversion intact.

Testing Guide

# Unit test (no live resources needed)
python -m unittest azure.cli.command_modules.containerapp.tests.latest.test_containerapp_utils.UtilsTest.test_convert_object_from_snake_to_camel_case_preserves_arm_resource_id_keys

To reproduce the original failure, use a YAML with a resource group name containing underscores in identity.userAssignedIdentities and verify the request body sent to ARM preserves the exact resource ID.

History Notes

[Container App] az containerapp create: Fix managed identity resource ID corrupted when resource group name contains underscores and --yaml is used


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 11, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 11, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

When az containerapp create --yaml is used with userAssignedIdentities,
the keys (ARM resource IDs) were incorrectly camelCased by
_convert_object_from_snake_to_camel_case, corrupting underscores in
resource group names (e.g. _NAME_PARTS -> NameParts).

Fix: skip camelCase conversion for keys that start with '/' (ARM resource IDs).
Add unit test to verify the fix.

Agent-Logs-Url: https://github.com/Azure/azure-cli/sessions/16735815-60d3-490a-8345-5bb464d4ba68

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix managed identity ID issue in az containerapp create [Container App] Fix managed identity resource ID corrupted by camelCase normalization when using --yaml May 11, 2026
Copilot finished work on behalf of a0x1ab May 11, 2026 08:48
Copilot AI requested a review from a0x1ab May 11, 2026 08:48
@yonzhan yonzhan assigned yanzhudd and unassigned zhoxing-ms May 11, 2026
@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 11, 2026

Container App

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

5 participants