Skip to content

az containerapp identity assign - work locally and not in azure devops #32197

Closed

Description

@walnut-co

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

  1. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Sep 30, 2025
  2. yonzhan commented on Sep 30, 2025

    @yonzhan
    Collaborator

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

  3. github-actions commented on Sep 30, 2025

    @github-actions

    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 aro preview 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

  4. added
    customer-reportedIssues that are reported by GitHub users external to the Azure organization.
    ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-group
    on Sep 30, 2025
  5. added
    Azure CLI TeamThe command of the issue is owned by Azure CLI team
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    Configureaz configure/config
    on Sep 30, 2025
  6. removed
    Azure CLI TeamThe command of the issue is owned by Azure CLI team
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Sep 30, 2025
  7. Greedygre commented on Oct 17, 2025

    @Greedygre
    Contributor

    Hi walnut-co

    Base on the error you shown:

    --user-assigned: command not found
    

    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:

    Image

    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

    Image
  8. azclibot commented on Jun 22, 2026

    @azclibot
    Collaborator

    Hi walnut-co, thanks for the report! Before we investigate further, we need a few clarifications:

    1. 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-assigned to 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?

    2. containerapp extension version in Azure DevOps: Please run az extension show --name containerapp --query version (or check az --version) inside the pipeline and share the output. The extension version may differ between your local machine and the Azure DevOps hosted agent.

    3. 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 containerapp extension and route it appropriately.


    Posted by agent-assist (autonomous bug-fix pipeline).

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions