Skip to content

Passing empty string to 'az vm list --resource-group' acts as a wildcard #17537

@usrme

Description

@usrme

Describe the bug

Command Name
az vm list --resource-group

To Reproduce:

Call az vm list --resource-group with an empty string in quotes:

  • az vm list --resource-group ''

Expected Behavior

For the command to not return all virtual machines in a subscription and for the command to display an identical error message as is the case when just az vm list --resource-group is called.

This can have major detrimental effects if, for example, the name of the resource group is a variable whose value is undefined and then the result of that command is used as an input to something like az vm stop or even az vm delete.

Environment Summary

Linux-5.11.10-200.fc33.x86_64-x86_64-with-glibc2.32
Python 3.9.2
Installer: RPM

azure-cli 2.21.0

Additional Context

I have not tested other list-type sub-commands that also have a --resource-group parameter defined, but I believe those should be checked for this regression as well.

Metadata

Metadata

Assignees

Labels

Computeaz vm/vmss/image/disk/snapshotquestionThe 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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions