az version --query "azure-cli" should return version number and not throw error
See original GitHub issueDescribe the bug
When I run az version --query "azure-cli"
it should return the version number: "2.4.0"
Command Name
az version
Errors:
az version: error: argument --query: invalid jmespath_type value: "azure-cli"'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
az version --query "azure-cli"
Expected Behavior
According to the tutorial pages you suggest people use to learn about JMESPath, it should work like this:
I copied the output from a plain az version
execution, and selected the field I wanted manually in the online tool.
I would expect az version --query "azure-cli"
to perform the same logical function and return 2.4.0
Environment Summary
Windows-10-10.0.17134-SP0
Python 3.6.6
Installer: MSI
azure-cli 2.4.0
Additional Context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Tips for using the Azure CLI successfully - Microsoft Learn
Learn tips for using Azure CLI successfully, such as output formats, passing parameter values, and quoting rules for different shells.
Read more >JMESPath query command results with Azure CLI
How to query Azure CLI command output using a JMESPath query ... to 'OsProfile' in the query above will not return the correct...
Read more >Output formats for Azure CLI commands - Microsoft Learn
Learn how to format the output of Azure CLI commands to tables, lists or json. ... none, No output other than errors and...
Read more >Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >How to install the Azure CLI - Microsoft Learn
The current version of the Azure CLI is 2.43.0. For information about the latest release, see the release notes. To find your installed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is the design of JMESPath that
-
is parsed as minus. See https://github.com/jmespath/jmespath.py/issues/109#issuecomment-240315651.So in the query
azure-cli
needs to be quoted as"azure-cli"
as you did in the screenshot:However, since the terminal interprets double quotes, the command needs to be escaped.
In Windows CMD:
In Windows PowerShell (Actually
\
shouldn’t be necessary, but we need them here due to https://github.com/PowerShell/PowerShell/issues/1995):In Bash:
@silentbobbert, I added some new contents in the doc. Maybe you are interested: https://github.com/Azure/azure-cli/pull/13249/files#diff-2f68bb7d55730e192dc93f133467a721R162-R175