Repository navigation
az containerapp identity assign - work locally and not in azure devops #32197
Description
Describe the bug
- task: AzureCLI@2
displayName: 'Assign Managed Identity and Update Container App'
inputs:
azureSubscription: $(serviceConnection)
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az config set extension.use_dynamic_install=yes_without_prompt
az provider register --namespace Microsoft.App
# ASSIGN THE IDENTITY
az containerapp identity assign \
--name $(image-name) \
--resource-group $(resource-group) \
--user-assigned '$(managed-identity-name)'
this task in azure devops not working with cli version of 2.77. however it works locally with all the latest version like 2.76 and 2.7..
Related command
az containerapp identity assign
--name $(image-name)
--resource-group $(resource-group) \
--user-assigned '$(managed-identity-name)'
Errors
ERROR: unrecognized arguments:
Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs
/home/vsts/work/_temp/azureclitaskscript1759214236821.sh: line 18: --user-assigned: command not found
Issue script & Debug output
ERROR: unrecognized arguments:
Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs
/home/vsts/work/_temp/azureclitaskscript1759214236821.sh: line 18: --user-assigned: command not found
Expected behavior
should work
Environment Summary
/usr/bin/az --version
azure-cli 2.77.0
core 2.77.0
telemetry 1.1.0
Extensions:
azure-devops 1.0.2
Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0
Python location '/opt/az/bin/python3'
Config directory '/home/vsts/.azure'
Extensions directory '/opt/az/azcliextensions'
Python (Linux) 3.13.7 (main, Aug 26 2025, 08:47:19) [GCC 13.3.0]
Additional context
No response
Activity
yonzhan commentedon Sep 30, 2025
Thank you for opening this issue, we will look into it.
github-actions commentedon Sep 30, 2025
Here are some similar issues that might help you. Please check if they can solve your problem.
Possible solution (Extracted from existing issue, might be incorrect; please verify carefully)
I've re-built the
az aropreview extension and published it to https://aka.ms/az-aroext-latest. It seems to be working on 2.77.0 now. Can you try it and confirm that the issue is resolved for you?Reference:
Powered by issue-sentinel
Greedygre commentedon Oct 17, 2025
Hi walnut-co
Base on the error you shown:
It is relate to the you are running On Linux and Line Break
\not work as expected.It treat
--user-assigned {}as a single command.Repro:
Don't know why the
\in script doesn't work as expect.Check the script you post, I found there is one extra space after
--resource-group $(resource-group) \.You should remove this.
Please have a try.
Thanks
azclibot commentedon Jun 22, 2026
Hi walnut-co, thanks for the report! Before we investigate further, we need a few clarifications:
Trailing space in line continuation: The script snippet in your issue shows
--resource-group $(resource-group) \(with a trailing space after the backslash). In bash, a backslash-newline continuation only works when\is the very last character on the line — a trailing space breaks it, causing--user-assignedto be interpreted as a standalone shell command (hence--user-assigned: command not found). Could you double-check your actual Azure DevOps YAML for any trailing spaces or invisible characters after the\characters?containerappextension version in Azure DevOps: Please runaz extension show --name containerapp --query version(or checkaz --version) inside the pipeline and share the output. The extension version may differ between your local machine and the Azure DevOps hosted agent.Minimal repro without variable expansion: To confirm this is a CLI regression and not a script-quoting issue, could you try replacing the
$(...)variable references with literal values in a test pipeline run and share the result?Once we have these details we can confirm whether this is a bug in the
containerappextension and route it appropriately.Posted by agent-assist (autonomous bug-fix pipeline).