Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

az containerapp create --yaml: issue with userAssignedIdentities #27272

Open Trueber opened 1 year ago

Trueber commented 1 year ago

Describe the bug

az containerapp create --yaml does mess up the resource group and user assigned identities if they contain - or _.

The id /subscriptions/my-subscription-id/resourcegroups/my_resource_group_dev/providers/Microsoft.Managedidentity/Userassignedidentities/my-user-assigned-identity

somehow gets changed to

/subscriptions/my-subscription-id/resourcegroups/myResourceGroupDev/providers/Microsoft.Managedidentity/Userassignedidentities/My-User-Assigned-Identity

on is then now found

Related command

az containerapp create

Errors

ERROR: (FailedIdentityOperation) Identity operation for resource '/subscriptions/my-subscription-id/resourceGroups/my_resource_group/providers/Microsoft.App/containerApps/my-container-app' failed with error 'Failed to perform resource identity operation. Status: 'BadRequest'. Response: '{"error":{"code":"BadRequest","message":"Resource '/subscriptions/my-subscription-id/resourcegroups/myResourceGroup/providers/Microsoft.Managedidentity/Userassignedidentities/My-User-Assigned-Identity' was not found."}}'.'.

Issue script & Debug output

az containerapp create -g my_resource_group -n my-container-app --yaml template.json

with template.json containing:

{
  "identity": {
    "type": "UserAssigned",
    "userAssignedIdentities": {
      "/subscriptions/my-subscription-id/resourcegroups/my_resource_group /providers/Microsoft.ManagedIdentity/userAssignedIdentities/my-user-assigned-identity": {}
    }
  },

debug.log

Expected behavior

The container app is created with user assigned identity

Environment Summary

azure-cli 2.51.0 core 2.51.0 telemetry 1.1.0 Extensions: containerapp 0.3.37 Dependencies: msal 1.24.0b1 azure-mgmt-resource 23.1.0b2

Can be reproduces on WSL/Ubuntu and container image mcr.microsoft.com/azure-cli

Additional context

No response

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @calvinsID.