Azure / Azure/azure-cli

JMESPath double-quotes disappear in powershell-core

Open
#30,098 4 comments 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM Auto-Assign Auto-Resolve Azure CLI Team customer-reported question Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

When I run
~~~
az group list --query '[?tags."aks-managed-cluster-name"==''somename'']'
~~~
then I get the following error
~~~
argument --query: invalid jmespath_type value: "[?tags.aks-managed-cluster-name=='somename']"
~~~
Notice the missing double quots in the path.

I also tried other variants of the input to get the quotes, but none seam to work.

### Related command

~~~
az group list --query '[?tags."aks-managed-cluster-name"==''somename'']'
~~~

### Errors

~~~
argument --query: invalid jmespath_type value: "[?tags.aks-managed-cluster-name=='somename']"
~~~

### Issue script & Debug output

~~~
cli.knack.cli: Command arguments: ['group', 'list', '--query', "[?tags.aks-managed-cluster-name=='somename']", '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [, , ]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'group': ['azure.cli.command_modules.resource']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: resource 0.015 47 207
cli.azure.cli.core: Total (1) 0.015 47 207
cli.azure.cli.core: Loaded 47 groups, 207 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : group list
cli.azure.cli.core: Command table: group list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\WEIK014\.azure\commands\2024-10-16.08-57-36.group_list.42908.log'.
az_command_data_logger: command args: group list --query {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x04A3AF58>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x04A43028>, .add_cache_arguments at 0x04A4D4F0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443
urllib3.connectionpool: https://app.aladdin.microsoft.com:443 "GET /api/v1.0/suggestions?query=%7B%22command%22%3A+%22group+list%22%2C+%22parameters%22%3A+%22--query%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.42.0%22%2C+%22errorType%22%3A+%22InvalidJMESPathQuery%22%2C+%22correlationId%22%3A+%22e8d68498-7625-48df-944b-013216e4e755%22%2C+%22subscriptionId%22%3A+%225d751263-acf6-4d8f-881a-944ccf3afd06%22%2C+%22eventId%22%3A+%22db6cbf8d-4f95-4ae5-8f13-0eb62325517f%22%7D HTTP/1.1" 200 None
~~~

### Expected behavior

That the quotes stay in the input string.

### Environment Summary

azure-cli 2.42.0 *

core 2.42.0 *
telemetry 1.0.8 *

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\WEIK014\.azure\cliextensions'

Python (Windows) 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:37:59) [MSC v.1933 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

OS: Windows 11
Shell: PowershellCore
~~~
Name Value
---- -----
PSVersion 7.4.5
PSEdition Core
GitCommitId 7.4.5
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
~~~

### Additional context

when I run
~~~
echo '[?tags."aks-managed-cluster-name"==''somename'']'
~~~
the quotes do not disappear.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.