Skip to content

[Question] Always returning an array from az resource show?  #18423

Closed

Description

The following command returns a single resource object

az resource show --ids {id_1}

The following command returns an array containing multiple resource objects

az resource show --ids {id_1} {id_2}

Is there an argument I can use to ensure that an array is returned, regardless of the number of ids supplied? I was wondering if it's possible with the --query flag, but I'm not familiar enough with JMESPath and couldn't spot anything obvious.

Activity

  1. ghost added
    needs-triageThis is a new issue that needs to be triaged to the appropriate team.
    on Jun 9, 2021
  2. added
    ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-group
    on Jun 9, 2021
  3. ghost removed
    needs-triageThis is a new issue that needs to be triaged to the appropriate team.
    on Jun 9, 2021
  4. added this to the S188 milestone on Jun 9, 2021
  5. yonzhan commented on Jun 9, 2021

    @yonzhan
    Collaborator

    ARM

  6. zhoxing-ms commented on Jul 8, 2021

    @zhoxing-ms
    Contributor

    Anthony Martin (@anthony-c-martin) Sorry, when only one item is returned the output is an object,when multiple items are returned the output is an array, this is by designed for show command.
    Does this output logic cause trouble for you to use JMESPath to parse the result? Could you control whether an object or an array is parsed according to the number of input parameters?

  7. anthony-c-martin commented on Jul 8, 2021

    @anthony-c-martin
    MemberAuthor

    Anthony Martin (@anthony-c-martin) Sorry, when only one item is returned the output is an object,when multiple items are returned the output is an array, this is by designed for show command.
    Does this output logic cause trouble for you to use JMESPath to parse the result? Could you control whether an object or an array is parsed according to the number of input parameters?

    Thanks for the explanation! It's not a blocker - it would just be nice to have a one-liner script to share that doesn't require any complex logic to handle both cases.

  8. teresaritorto commented on Oct 12, 2026

    @teresaritorto
    Contributor

    Thanks for confirming this is not a blocker. As explained, this is by design for show commands: a single --ids value returns a single object and multiple values return an array. Since the question has been answered and you noted it is not blocking, I am closing this out.

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

Metadata

Metadata

Labels

ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-groupact-identity-squadfeature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions