Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

az command "--query flag" inconsistency in windows vs linux #26583

Open HarshaNalluru opened 1 year ago

HarshaNalluru commented 1 year ago

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 <resource-group> -n <account-name> --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 <resource-group> -n <account-name> --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 <resource-group> -n <account-name> --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

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

ghost commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @albertofori, @avanigupta.

Issue Details
### 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_
Author: HarshaNalluru
Assignees: -
Labels: `bug`, `Service Attention`, `App Configuration`, `CXP Attention`, `Auto-Assign`
Milestone: -
v-xuto commented 3 months ago

@yonzhan, @albertofori What is the current progress on this issue?