az command "--query flag" inconsistency in windows vs linux
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Describe the bug
There is a bug in the `az cli` command when running on Windows.
Accessing the indices in arrays is not allowed in windows..
I see the error message `[0] was unexpected at this time`.
### Related command
`az appconfig credential list -g -n --query "([?name=='Primary'].connectionString)[0]"`
Works in linux
> "Endpoint=https://account-name.azconfig.io;Id=;Secret="
Fails in windows
> [0] was unexpected at this time.
C:\path> "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\\..\python.exe" -IBm azure.cli appconfig credential list -g -n --query ([?name=='Primary'].connectionString)[0]
### Errors
```
[0] was unexpected at this time.
C:\path> "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\\..\python.exe" -IBm azure.cli appconfig credential list -g -n --query ([?name=='Primary'].connectionString)[0]
```
### Issue script & Debug output
```
[0] was unexpected at this time.
C:\path> "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\\..\python.exe" -IBm azure.cli appconfig credential list -g -n --query ([?name=='Primary'].connectionString)[0]
```
### Expected behavior
Expected the command to work the same way in both linux and windows.
Expected to not fail in windows.
### Environment Summary
azure-cli 2.49.0
core 2.49.0
telemetry 1.0.8
Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\sanallur\.azure\cliextensions'
Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
### Additional context
_Originally found at https://github.com/Azure/azure-sdk-for-js/issues/26034_
Contributor guide
Assessment
This issue has not been assessed yet.