Skip to content

--ids argument documentation is incorrect #29502

@sochotnicky

Description

@sochotnicky

Describe the bug

az vm show --help includes this:

Resource Id Arguments
    --ids                  : One or more resource IDs (space-delimited). It should be a complete
                             resource ID containing all information of 'Resource Id' arguments. You
                             should provide either --ids or other 'Resource Id' arguments.

Note that it says space-delimited. However using spaces between resource IDs is not enough, newlines have to be used.

Example:

$ az vm show --ids '/subscriptions/<SUBID>/resourceGroups/<RGID>/providers/Microsoft.Compute/virtualMachines/<VM NAME1> /subscriptions/<SUBID>/resourceGroups/<RGID>/providers/Microsoft.Compute/virtualMachines/<VM NAME2>'
<JSON of VM NAME1> 
missing VM NAME2

$ az vm show --ids "(echo -e /subscriptions/<SUBID>/resourceGroups/<RGID>/providers/Microsoft.Compute/virtualMachines/<VM NAME1>\\n/subscriptions/<SUBID>/resourceGroups/<RGID>/providers/Microsoft.Compute/virtualMachines/<VM NAME2>)"
<array for 2 VMs>

Some other commands completely fail with confusing error messages when --ids are not newline delimited. Basically using tsv output ID from various list commands works here.

Related command

az vm show, az vm start etc

Errors

When used with az vm start --ids:

(ResourceNotFound) The Resource 'Microsoft.Compute/virtualMachines/ ' under resource group '' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Code: ResourceNotFound
Message: The Resource 'Microsoft.Compute/virtualMachines/ ' under resource group '' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

Issue script & Debug output

This is I think the important part where for example vm start fails:

urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/<SUBID>/resourceGroups/<RGID>/providers/Microsoft.Compute/virtualMachines/<VM_NAME1>%20/start?api-version=2022-11-01 HTTP/1.1" 404 235

It encodes the space and uses it as part of resource name it's requesting

Expected behavior

Either of the following would be acceptable:

  • Update documentation to make it clear that newlines are required as separators
  • Actually accept spaces between resource IDs

Environment Summary

$ az --version
azure-cli                         2.60.0 *

core                              2.60.0 *
telemetry                          1.1.0

Dependencies:
msal                              1.28.0
azure-mgmt-resource             23.1.0b2

Additional context

No response

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotSimilar-Issueact-observability-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions