Related command
az account subscription list-location --subscription-id "$subid" --query "[? contains(name, "uk")]"
Describe the bug
--query "[? contains(name, "uk")]" should use single quotes instead of double quotes. In which case the following TypeError is not being caught and generates a traceback in the az cli:
TypeError: 'in <string>' requires string as left operand, not NoneType
The correct version of the command (single quotes) works as expected:
az account subscription list-location --subscription-id "$subid" --query "[? contains(name, 'uk')]"
To Reproduce
az account subscription list-location --subscription-id "$subid" --query "[? contains(name, "uk")]"
Expected behavior
The error should be caught and output should silenced. This would make the behaviour consistent with GA status command groups. For example, the following equivalent invalid query (double quotes) will silence the output instead:
az account show --query "[? contains(name, "uk")]"
Additional comments
The existing behaviour of silencing output is applied in both cases of
az account show --query "[? contains(name, "uk")]" (bad syntax) and az account show --query "[? contains(name, 'uk')]" (good syntax). In my opinion this isn't optimal as it doesn't differentiate between a syntax error and a not found result (valid user experience). Ideally the caught error should be communicated differently (i.e. not silenced) to the user so that they can modify their syntax accordingly. Otherwise they may mistakenly believe that their syntax was valid but that the string they searched for did not exist.
Environment summary
az version -o table
Azure-cli Azure-cli-core Azure-cli-telemetry
2.42.0 2.42.0 1.0.8
echo $BASH_VERSION
4.4.23(1)-release
az extension list -o table
Experimental ExtensionType Name Path Preview Version
False whl account C:\Users\dc.azure\cliextensions\account False 0.2.5
False whl azure-devops C:\Users\dc.azure\cliextensions\azure-devops False 0.25.0
False whl datafactory C:\Users\dc.azure\cliextensions\datafactory False 0.7.0
False whl storage-preview C:\Users\dc.azure\cliextensions\storage-preview True 0.3.0
Related command
az account subscription list-location --subscription-id "$subid" --query "[? contains(name, "uk")]"Describe the bug
--query "[? contains(name, "uk")]"should use single quotes instead of double quotes. In which case the following TypeError is not being caught and generates a traceback in the az cli:TypeError: 'in <string>' requires string as left operand, not NoneTypeThe correct version of the command (single quotes) works as expected:
az account subscription list-location --subscription-id "$subid" --query "[? contains(name, 'uk')]"To Reproduce
az account subscription list-location --subscription-id "$subid" --query "[? contains(name, "uk")]"Expected behavior
The error should be caught and output should silenced. This would make the behaviour consistent with GA status command groups. For example, the following equivalent invalid query (double quotes) will silence the output instead:
az account show --query "[? contains(name, "uk")]"Additional comments
The existing behaviour of silencing output is applied in both cases of
az account show --query "[? contains(name, "uk")]"(bad syntax) andaz account show --query "[? contains(name, 'uk')]"(good syntax). In my opinion this isn't optimal as it doesn't differentiate between a syntax error and a not found result (valid user experience). Ideally the caught error should be communicated differently (i.e. not silenced) to the user so that they can modify their syntax accordingly. Otherwise they may mistakenly believe that their syntax was valid but that the string they searched for did not exist.Environment summary
az version -o tableAzure-cli Azure-cli-core Azure-cli-telemetry
2.42.0 2.42.0 1.0.8
echo $BASH_VERSION4.4.23(1)-release
az extension list -o tableExperimental ExtensionType Name Path Preview Version
False whl account C:\Users\dc.azure\cliextensions\account False 0.2.5
False whl azure-devops C:\Users\dc.azure\cliextensions\azure-devops False 0.25.0
False whl datafactory C:\Users\dc.azure\cliextensions\datafactory False 0.7.0
False whl storage-preview C:\Users\dc.azure\cliextensions\storage-preview True 0.3.0