Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az resource list with --query parameter returns inconsistent results across multiple runs #23212

Open
matthchr opened this issue Jul 14, 2022 · 7 comments
Assignees
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved.
Milestone

Comments

@matthchr
Copy link
Member

Related command
az resource list --tag freeforpipeline=true --query "[?type=='Microsoft.ContainerService/managedClusters']" --debug

Describe the bug
az resource list with --query parameter returns inconsistent results across multiple runs. I have used the --debug flag and can clearly see that the service is returning the correct data in the GET request payload, but that data is not being consistently returned in the result of the az resource list call. Sometimes it works, sometimes it doesn't work. In my case my list should always return 5 items, but sometimes it's returning 5 and sometimes it's returning 0. Repeated runs can quickly fluctuate between 5 and 0 results. There are no changes on the actual resources in question, they should always match the query.

To Reproduce
Create a few resources with a tag (my tag was freeforpipeline=true) and try to query them with az resource list --query.

Expected behavior
My collection of 5 resources should be returned every time, because all 5 of them match

Environment summary
I have reproduced this problem in 2 environments:

Linux
Install method: apt
Shell: Bash

azure-cli                         2.37.0 *

core                              2.37.0 *
telemetry                          1.0.6

Extensions:
k8s-extension                      1.2.3
k8s-configuration                  1.5.1
aks-preview                       0.5.58

Dependencies:
msal                            1.18.0b1
azure-mgmt-resource             21.1.0b1

Python location '/opt/az/bin/python3'
Extensions directory '/home/matthchr/.azure/cliextensions'

Python (Linux) 3.10.4 (main, May 23 2022, 14:03:04) [GCC 7.5.0]

Windows
Install method: MSI
Shell: cmd.exe

C:\Users\matthchr>az --version
azure-cli                         2.38.0

core                              2.38.0
telemetry                          1.0.6

Dependencies:
msal                            1.18.0b1
azure-mgmt-resource             21.1.0b1

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

Python (Windows) 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 15:58:59) [MSC v.1929 32 bit (Intel)]

Additional context

Logs from a successful call:

cli.knack.cli: Command arguments: ['resource', 'list', '--tag', 'freeforpipeline=true', '--query', "[?type=='Microsoft.ContainerService/managedClusters']", '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
Init colorama.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x01E0CDF0>, <function OutputProducer.on_global_arguments at 0x01FCE730>, <function CLIQuery.on_global_arguments at 0x01FEB388>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'resource': ['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.021        47       207
cli.azure.cli.core: Total (1)                 0.021        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  : resource list
cli.azure.cli.core: Command table: resource list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x043B2FA0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\matthchr\.azure\commands\2022-07-14.13-52-33.resource_list.7200.log'.
az_command_data_logger: command args: resource list --tag {} --query {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x043E9E38>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x043E9F10>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x044154A8>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01FCE778>, <function CLIQuery.handle_query_parameter at 0x01FEB3D0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x04415460>]
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='C:\\Users\\matthchr\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: C:\Users\matthchr\.azure\msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/kerberos', 'tenant_region_scope': 'WW', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 39d26044-ec00-4eed-a1fc-7c59356be38a
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resources?$filter=tagname%20eq%20%27freeforpipeline%27%20and%20tagvalue%20eq%20%27true%27&$expand=createdTime%2CchangedTime%2CprovisioningState&api-version=2021-04-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': 'e2982475-03b6-11ed-8262-1ca0b874ba40'
cli.azure.cli.core.sdk.policies:     'CommandName': 'resource list'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--tag --query --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.38.0 (MSI) azsdk-python-azure-mgmt-resource/21.1.0b1 Python/3.10.5 (Windows-10-10.0.19044-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resources?$filter=tagname%20eq%20%27freeforpipeline%27%20and%20tagvalue%20eq%20%27true%27&$expand=createdTime%2CchangedTime%2CprovisioningState&api-version=2021-04-01 HTTP/1.1" 200 1767
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-reads': '11999'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': 'cfe7657b-51b1-4e4d-b3c3-61cb696fece2'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': 'cfe7657b-51b1-4e4d-b3c3-61cb696fece2'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'WESTUS:20220714T205234Z:cfe7657b-51b1-4e4d-b3c3-61cb696fece2'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'Date': 'Thu, 14 Jul 2022 20:52:34 GMT'
cli.azure.cli.core.sdk.policies:     'Content-Length': '1767'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"value":[{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-2_southcentralus/providers/Microsoft.Network/loadBalancers/kubernetes","name":"kubernetes","type":"Microsoft.Network/loadBalancers","sku":{"name":"Standard"},"location":"southcentralus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-2_southcentralus/providers/Microsoft.Network/networkSecurityGroups/aks-agentpool-37244336-nsg","name":"aks-agentpool-37244336-nsg","type":"Microsoft.Network/networkSecurityGroups","location":"southcentralus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-2_southcentralus/providers/Microsoft.Network/virtualNetworks/aks-vnet-37244336","name":"aks-vnet-37244336","type":"Microsoft.Network/virtualNetworks","location":"southcentralus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.Network/loadBalancers/kubernetes","name":"kubernetes","type":"Microsoft.Network/loadBalancers","sku":{"name":"Standard"},"location":"eastus","tags":{"aks-managed-cluster-name":"aso-azdo-aks-5","aks-managed-cluster-rg":"resourcegroup-azure-operators","freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/omsagent-aso-azdo-aks-5","name":"omsagent-aso-azdo-aks-5","type":"Microsoft.ManagedIdentity/userAssignedIdentities","location":"eastus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aso-azdo-aks-5-agentpool","name":"aso-azdo-aks-5-agentpool","type":"Microsoft.ManagedIdentity/userAssignedIdentities","location":"eastus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.Network/networkSecurityGroups/aks-agentpool-26624594-nsg","name":"aks-agentpool-26624594-nsg","type":"Microsoft.Network/networkSecurityGroups","location":"eastus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.Network/virtualNetworks/aks-vnet-26624594","name":"aks-vnet-26624594","type":"Microsoft.Network/virtualNetworks","location":"eastus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.Compute/virtualMachineScaleSets/aks-agentpool-26624594-vmss","name":"aks-agentpool-26624594-vmss","type":"Microsoft.Compute/virtualMachineScaleSets","sku":{"name":"Standard_DS2_v2","tier":"Standard","capacity":3},"location":"eastus","identity":{"type":"UserAssigned","userAssignedIdentities":{"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourcegroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/omsagent-aso-azdo-aks-5":{"principalId":"a8101eea-d404-4274-9514-f8ddce59cde5","clientId":"d6bb9358-feb4-47de-8432-78b5ed11323c"},"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aso-azdo-aks-5-agentpool":{"principalId":"baed742f-30a7-4597-a7b2-e0e4bf12c175","clientId":"07115d3b-cc36-4604-aeb3-0d4dfd7ab1bb"},"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourcegroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kubedashboard-aso-azdo-aks-5":{"principalId":"a626a9ba-e917-4e81-bfae-a67f7d9b28ad","clientId":"751ccf94-7087-46c5-ae65-a58bb84123f8"}}},"tags":{"freeforpipeline":"true","orchestrator":"Kubernetes:1.21.2","poolName":"agentpool"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-3_westus/providers/Microsoft.Network/loadBalancers/kubernetes","name":"kubernetes","type":"Microsoft.Network/loadBalancers","sku":{"name":"Standard"},"location":"westus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/mc_resourcegroup-azure-operators_aso-azdo-aks-3_westus/providers/Microsoft.Network/routeTables/aks-agentpool-77519960-routetable","name":"aks-agentpool-77519960-routetable","type":"Microsoft.Network/routeTables","location":"westus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-3_westus/providers/Microsoft.Network/networkSecurityGroups/aks-agentpool-77519960-nsg","name":"aks-agentpool-77519960-nsg","type":"Microsoft.Network/networkSecurityGroups","location":"westus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-3_westus/providers/Microsoft.Network/virtualNetworks/aks-vnet-77519960","name":"aks-vnet-77519960","type":"Microsoft.Network/virtualNetworks","location":"westus","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks","name":"aso-azdo-aks","type":"Microsoft.ContainerService/managedClusters","location":"westus2","identity":{"principalId":"ffb29867-45ef-463f-8a4f-36de6c3dc513","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks_westus2/providers/Microsoft.Network/loadBalancers/kubernetes","name":"kubernetes","type":"Microsoft.Network/loadBalancers","sku":{"name":"Standard"},"location":"westus2","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks_westus2/providers/Microsoft.Network/networkSecurityGroups/aks-agentpool-32927831-nsg","name":"aks-agentpool-32927831-nsg","type":"Microsoft.Network/networkSecurityGroups","location":"westus2","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-2","name":"aso-azdo-aks-2","type":"Microsoft.ContainerService/managedClusters","location":"southcentralus","identity":{"principalId":"45c8424f-d3a1-4cb0-b4e8-b5e109b0a3df","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-3","name":"aso-azdo-aks-3","type":"Microsoft.ContainerService/managedClusters","location":"westus","identity":{"principalId":"6582259d-cd55-40bd-b5ae-4ef4ce77ad69","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-4","name":"aso-azdo-aks-4","type":"Microsoft.ContainerService/managedClusters","location":"westus2","identity":{"principalId":"c0afbab2-4b9f-4562-a8b3-64f3a2a65364","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-4_westus2/providers/Microsoft.Network/loadBalancers/kubernetes","name":"kubernetes","type":"Microsoft.Network/loadBalancers","sku":{"name":"Standard"},"location":"westus2","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-4_westus2/providers/Microsoft.Network/networkSecurityGroups/aks-agentpool-17654644-nsg","name":"aks-agentpool-17654644-nsg","type":"Microsoft.Network/networkSecurityGroups","location":"westus2","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-4_westus2/providers/Microsoft.Network/virtualNetworks/aks-vnet-17654644","name":"aks-vnet-17654644","type":"Microsoft.Network/virtualNetworks","location":"westus2","tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-5","name":"aso-azdo-aks-5","type":"Microsoft.ContainerService/managedClusters","location":"eastus","identity":{"principalId":"3b6744b0-5723-41df-9ace-8901f6190f4c","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"tags":{"freeforpipeline":"true"}},{"id":"/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/MC_resourcegroup-azure-operators_aso-azdo-aks-5_eastus/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kubedashboard-aso-azdo-aks-5","name":"kubedashboard-aso-azdo-aks-5","type":"Microsoft.ManagedIdentity/userAssignedIdentities","location":"eastus","tags":{"freeforpipeline":"true"}}]}
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x043E9070>, <function _x509_from_base64_to_hex_transform at 0x043E90B8>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult [<function CLIQuery.handle_query_parameter.<locals>.filter_output at 0x04E638E0>]
[
  {
    "changedTime": null,
    "createdTime": null,
    "extendedLocation": null,
    "id": "/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks",
    "identity": {
      "principalId": "ffb29867-45ef-463f-8a4f-36de6c3dc513",
      "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
      "type": "SystemAssigned",
      "userAssignedIdentities": null
    },
    "kind": null,
    "location": "westus2",
    "managedBy": null,
    "name": "aso-azdo-aks",
    "plan": null,
    "properties": null,
    "provisioningState": null,
    "resourceGroup": "resourcegroup-azure-operators",
    "sku": null,
    "tags": {
      "freeforpipeline": "true"
    },
    "type": "Microsoft.ContainerService/managedClusters"
  },
  {
    "changedTime": null,
    "createdTime": null,
    "extendedLocation": null,
    "id": "/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-2",
    "identity": {
      "principalId": "45c8424f-d3a1-4cb0-b4e8-b5e109b0a3df",
      "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
      "type": "SystemAssigned",
      "userAssignedIdentities": null
    },
    "kind": null,
    "location": "southcentralus",
    "managedBy": null,
    "name": "aso-azdo-aks-2",
    "plan": null,
    "properties": null,
    "provisioningState": null,
    "resourceGroup": "resourcegroup-azure-operators",
    "sku": null,
    "tags": {
      "freeforpipeline": "true"
    },
    "type": "Microsoft.ContainerService/managedClusters"
  },
  {
    "changedTime": null,
    "createdTime": null,
    "extendedLocation": null,
    "id": "/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-3",
    "identity": {
      "principalId": "6582259d-cd55-40bd-b5ae-4ef4ce77ad69",
      "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
      "type": "SystemAssigned",
      "userAssignedIdentities": null
    },
    "kind": null,
    "location": "westus",
    "managedBy": null,
    "name": "aso-azdo-aks-3",
    "plan": null,
    "properties": null,
    "provisioningState": null,
    "resourceGroup": "resourcegroup-azure-operators",
    "sku": null,
    "tags": {
      "freeforpipeline": "true"
    },
    "type": "Microsoft.ContainerService/managedClusters"
  },
  {
    "changedTime": null,
    "createdTime": null,
    "extendedLocation": null,
    "id": "/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-4",
    "identity": {
      "principalId": "c0afbab2-4b9f-4562-a8b3-64f3a2a65364",
      "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
      "type": "SystemAssigned",
      "userAssignedIdentities": null
    },
    "kind": null,
    "location": "westus2",
    "managedBy": null,
    "name": "aso-azdo-aks-4",
    "plan": null,
    "properties": null,
    "provisioningState": null,
    "resourceGroup": "resourcegroup-azure-operators",
    "sku": null,
    "tags": {
      "freeforpipeline": "true"
    },
    "type": "Microsoft.ContainerService/managedClusters"
  },
  {
    "changedTime": null,
    "createdTime": null,
    "extendedLocation": null,
    "id": "/subscriptions/4ef44fef-c51d-4d7c-a6ff-8635c02848b1/resourceGroups/resourcegroup-azure-operators/providers/Microsoft.ContainerService/managedClusters/aso-azdo-aks-5",
    "identity": {
      "principalId": "3b6744b0-5723-41df-9ace-8901f6190f4c",
      "tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
      "type": "SystemAssigned",
      "userAssignedIdentities": null
    },
    "kind": null,
    "location": "eastus",
    "managedBy": null,
    "name": "aso-azdo-aks-5",
    "plan": null,
    "properties": null,
    "provisioningState": null,
    "resourceGroup": "resourcegroup-azure-operators",
    "sku": null,
    "tags": {
      "freeforpipeline": "true"
    },
    "type": "Microsoft.ContainerService/managedClusters"
  }
]
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x043B4100>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 1.557 seconds (init: 0.633, invoke: 0.924)
telemetry.save: Save telemetry record of length 2928 in cache
telemetry.check: Negative: The C:\Users\matthchr\.azure\telemetry.txt was modified at 2022-07-14 13:45:52.753201, which in less than 600.000000 s

The key difference seem to be that the successful request has 'x-ms-routing-request-id': 'WESTUS:20220714T205234Z:cfe7657b-51b1-4e4d-b3c3-61cb696fece2', while the request that doesn't filter correctly has 'x-ms-routing-request-id': 'WESTCENTRALUS:20220714T205344Z:f72a16df-5452-456d-88f9-fa1d7c86c89b'

The request that doesn't filter correctly has the resource types cased differently than the one that works:
Routing request from WestUS cases it like this: Microsoft.ContainerService/managedClusters
Routing request from WestCentralUS cases it like this: microsoft.containerservice/managedclusters

@ghost ghost added Auto-Assign Auto assign by bot ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group labels Jul 14, 2022
@ghost ghost assigned zhoxing-ms Jul 14, 2022
@ghost ghost added this to the Backlog milestone Jul 14, 2022
@ghost ghost added the Graph az ad label Jul 14, 2022
@ghost ghost assigned jiasli Jul 14, 2022
@ghost ghost added the Installation label Jul 14, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 15, 2022

ARM

@yonzhan yonzhan added the CXP Attention This issue is handled by CXP team. label Jul 15, 2022
@ghost
Copy link

ghost commented Jul 15, 2022

Thank you for your feedback. This has been routed to the support team for assistance.

@zhoxing-ms
Copy link
Contributor

zhoxing-ms commented Jul 15, 2022

The request that doesn't filter correctly has the resource types cased differently than the one that works:
Routing request from WestUS cases it like this: Microsoft.ContainerService/managedClusters
Routing request from WestCentralUS cases it like this: microsoft.containerservice/managedclusters

The --query parameter is case sensitive which is by designed, because it uses the jmespath syntax.
So this issue requires the REST service to solve the problem of inconsistent case

@yonzhan yonzhan added Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Aug 14, 2022
@PramodValavala-MSFT PramodValavala-MSFT removed the CXP Attention This issue is handled by CXP team. label Oct 19, 2022
@springcomp
Copy link

springcomp commented Nov 23, 2022

FYI as per #24542, the new JMESPath Community build of the Python library supports the lower() function that would help support case insensitive comparison.

@MAN98
Copy link

MAN98 commented Jun 4, 2024

I am also encountering this issue and would really love to hear when this can be resolved or what are other ways to achieve a consistent result.

@MAN98
Copy link

MAN98 commented Jun 7, 2024

Got a workaround for my CRON Job by supplying all possible casing of the VMName that I am using as parameter in my query. Not pretty but it works until that lower function gets included in Azure CLI.

When should we expect that lower function from JMESPath be included in Azure CLI?

@springcomp
Copy link

To be transparent, that does not seem highly likely at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved.
Projects
None yet
Development

No branches or pull requests

7 participants