Skip to content

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

@HarshaNalluru

Description

@HarshaNalluru

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 Azure/azure-sdk-for-js#26034

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions