Azure / azure-cli

Azure Command-Line Interface
MIT License
4.04k stars 3.01k forks source link

Greater Than or Equal To not Supported in AZ VM LIST Qury #26698

Open Spyntek opened 1 year ago

Spyntek commented 1 year ago

Describe the bug

I am receiving an error when performing a query of az vm list, particularly storage disk size.

Related command

az vm list --query "[?storageProfile.osDisk.diskSizeGb >= '750'].{Name:name, OS_Disk_Size_GB:storageProfile.osDisk.diskSizeGb, Data_Disk_Size_GB:storageProfile.dataDisks[0].diskSizeGb}"

Errors

The command failed with an unexpected error. Here is the traceback: '>=' not supported between instances of 'int' and 'str' Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 675, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 170, in raise_event File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/query.py", line 45, in filter_output File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/parser.py", line 509, in search File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 180, in visit_filter_projection File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 158, in visit_comparator TypeError: '>=' not supported between instances of 'int' and 'str'

Issue script & Debug output

cli.knack.log: File logging enabled - writing logs to 'C:\Users\spynt.azure\logs'. cli.knack.cli: Command arguments: ['vm', 'list', '--query', "[?storageProfile.osDisk.diskSizeGb >= '750' || storageProfile.dataDisks[0].diskSizeGb >= '750'].{Name:name, OS_Disk_Size_GB:storageProfile.osDisk.diskSizeGb, Data_Disk_Size_GB:storageProfile.dataDisks[0].diskSizeGb}", '--debug'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x01E2B460>, <function OutputProducer.on_global_arguments at 0x01EF8BF8>, <function CLIQuery.on_global_arguments at 0x01F17850>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'vm': ['azure.cli.command_modules.vm'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: vm 0.356 57 288 cli.azure.cli.core: Total (1) 0.356 57 288 cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next'] cli.azure.cli.core: Loading extensions: cli.azure.cli.core: Name Load Time Groups Commands Directory cli.azure.cli.core: ai-examples 0.068 1 1 C:\Users\spynt.azure\cliextensions\ai-examples cli.azure.cli.core: Total (1) 0.068 1 1 cli.azure.cli.core: Loaded 58 groups, 289 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : vm list cli.azure.cli.core: Command table: vm list cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x041EB388>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\spynt.azure\commands\2023-06-16.10-48-50.vm_list.22812.log'. az_command_data_logger: command args: vm list --query {} --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x042164F0>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x042405C8>, <function register_cache_arguments..add_cache_arguments at 0x04240658>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01EF8C40>, <function CLIQuery.handle_query_parameter at 0x01F17898>, <function register_ids_argument..parse_ids_arguments at 0x04240610>] cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ComputeManagementClient cli.azure.cli.core.auth.persistence: build_persistence: location='C:\Users\spynt\.azure\msal_token_cache.bin', encrypt=True cli.azure.cli.core.auth.binary_cache: load: C:\Users\spynt.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/9ceb45d9-8994-49de-a178-bcc598fec3ce/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/9ceb45d9-8994-49de-a178-bcc598fec3ce/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/9ceb45d9-8994-49de-a178-bcc598fec3ce/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/9ceb45d9-8994-49de-a178-bcc598fec3ce/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/9ceb45d9-8994-49de-a178-bcc598fec3ce/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/9ceb45d9-8994-49de-a178-bcc598fec3ce/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/9ceb45d9-8994-49de-a178-bcc598fec3ce/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'} msal.application: Broker enabled? False 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',), claims=None, kwargs={} msal.application: Cache hit an AT msal.telemetry: Generate or reuse correlation_id: bc72b381-29e7-4f32-867e-59809b6bac33 cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/f3e5381e-28a5-4ede-a3c9-6850bac5232f/providers/Microsoft.Compute/virtualMachines?api-version=2022-11-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': 'e7df27fa-0c54-11ee-895b-6ca10003abe2' cli.azure.cli.core.sdk.policies: 'CommandName': 'vm list' cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--query --debug' cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.49.0 (MSI) azsdk-python-azure-mgmt-compute/29.1.0 Python/3.10.10 (Windows-10-10.0.22631-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/f3e5381e-28a5-4ede-a3c9-6850bac5232f/providers/Microsoft.Compute/virtualMachines?api-version=2022-11-01 HTTP/1.1" 200 14189 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-original-request-ids': '6281f030-2949-45dc-862f-9bf6f3966e9c, e2a7462d-83ed-4090-8d70-f0887c8a2490, 7b289d84-a798-4e65-80d5-4c6b199098b1, e31b07bd-ac9f-40af-8a09-3be9981b460e, de5f3712-fe6d-45bd-91cf-443c78e60db6, 04394887-82f4-4f4f-a1a1-5c9abe814c6f' cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '11999' cli.azure.cli.core.sdk.policies: 'x-ms-request-id': 'b3c3f379-6bfb-409e-b84c-063abfef0591' cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'b3c3f379-6bfb-409e-b84c-063abfef0591' cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'CANADACENTRAL:20230616T144856Z:b3c3f379-6bfb-409e-b84c-063abfef0591' 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': 'Fri, 16 Jun 2023 14:48:56 GMT' cli.azure.cli.core.sdk.policies: 'Content-Length': '14189' cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x04212BB0>, <function _x509_from_base64_to_hex_transform at 0x04212BF8>] cli.knack.cli: Event: CommandInvoker.OnFilterResult [<function CLIQuery.handle_query_parameter..filter_output at 0x0555F0B8>] cli.azure.cli.core.azclierror: Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 675, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 170, in raise_event File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/query.py", line 45, in filter_output File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/parser.py", line 509, in search File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 180, in visit_filter_projection File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 247, in visit_or_expression File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 158, in visit_comparator TypeError: '>=' not supported between instances of 'int' and 'str'

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback: az_command_data_logger: The command failed with an unexpected error. Here is the traceback: cli.azure.cli.core.azclierror: '>=' not supported between instances of 'int' and 'str' Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 675, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 170, in raise_event File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/query.py", line 45, in filter_output File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/parser.py", line 509, in search File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 180, in visit_filter_projection File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 247, in visit_or_expression File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 158, in visit_comparator TypeError: '>=' not supported between instances of 'int' and 'str' az_command_data_logger: '>=' not supported between instances of 'int' and 'str' Traceback (most recent call last): File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 675, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 170, in raise_event File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/query.py", line 45, in filter_output File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/parser.py", line 509, in search File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 180, in visit_filter_projection File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 247, in visit_or_expression File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 94, in visit File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\jmespath/visitor.py", line 158, in visit_comparator TypeError: '>=' not supported between instances of 'int' and 'str' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x041EB4A8>] az_command_data_logger: exit code: 1 cli.main: Command ran in 2.084 seconds (init: 0.385, invoke: 1.699) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 6945 in cache telemetry.check: Returns Positive. telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry__init__.pyc C:\Users\spynt.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.

Expected behavior

based on the command input, I should be receiving a list of VM's based upon the query, which would filter out any VM's whose disk size is less than 750GB

Environment Summary

azure-cli 2.49.0

core 2.49.0 telemetry 1.0.8

Extensions: ai-examples 0.2.5 azure-cli-ml 1.41.0 azure-devops 0.26.0 bastion 0.2.4 blueprint 0.3.1 cli-translator 0.3.0 init 0.1.0 interactive 0.5.1 internet-analyzer 0.1.0rc6

Dependencies: msal 1.20.0 azure-mgmt-resource 22.0.0

Additional context

No response

yonzhan commented 1 year ago

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