Azure / azure-cli

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

Fail to receive list of Azure Arc connected machines #28238

Open ryanjcanning opened 10 months ago

ryanjcanning commented 10 months ago

Describe the bug

When attempting to get a list of Azure Arc machines within a resource group (using the connectedmachine extension), it fails. Appears to work fine on resource groups with small amount of Arc machines, but RG's that have ~100+ it fails with error below. When running with --debug, it pulls a list but fails with nextlink property.

Related command

az connectedmachine list

Errors

CMD-LOG-LINE-BEGIN 13812 | 2024-01-24 08:14:12,009 | INFO | az_command_data_logger | command args: connectedmachine list --resource-group {} --subscription {} --debug
CMD-LOG-LINE-BEGIN 13812 | 2024-01-24 08:14:12,035 | INFO | az_command_data_logger | extension name: connectedmachine
CMD-LOG-LINE-BEGIN 13812 | 2024-01-24 08:14:12,035 | INFO | az_command_data_logger | extension version: 0.7.0
CMD-LOG-LINE-BEGIN 13812 | 2024-01-24 08:14:12,957 | ERROR | az_command_data_logger | The command failed with an unexpected error. Here is the traceback:
CMD-LOG-LINE-BEGIN 13812 | 2024-01-24 08:14:12,966 | ERROR | az_command_data_logger | Expect <class 'str'>, got 0 (<class 'int'>)

Issue script & Debug output

PS C:\Users\{USER}> az connectedmachine list --resource-group "{RESOURCEGROUP}" --subscription "{SUBSCRIPTION}" --debug
cli.knack.cli: Command arguments: ['connectedmachine', 'list', '--resource-group', '{RESOURCEGROUP}', '--subscription', '{SUBSCRIPTION}', '--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 0x01A4E7A8>, <function OutputProducer.on_global_arguments at 0x01D78898>, <function CLIQuery.on_global_arguments at 0x01D98668>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'connectedmachine': ['azext_connectedmachine']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: Total (0)                 0.000         0         0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: connectedmachine          0.463         6        13  C:\Users\{USER}\.azure\cliextensions\connectedmachine
cli.azure.cli.core: Total (1)                 0.463         6        13
cli.azure.cli.core: Loaded 6 groups, 13 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : connectedmachine list
cli.azure.cli.core: Command table: connectedmachine list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0415D078>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\{USER}\.azure\commands\2024-01-24.08-47-51.connectedmachine_list.34604.log'.
az_command_data_logger: command args: connectedmachine list --resource-group {} --subscription {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x0416AC58>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x041B5348>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x041B5398>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01D788E8>, <function CLIQuery.handle_query_parameter at 0x01D986B8>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x041B52F8>]
az_command_data_logger: extension name: connectedmachine
az_command_data_logger: extension version: 0.7.0
cli.azure.cli.core.auth.persistence: build_persistence: location='C:\\Users\\{USER}\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: C:\Users\{USER}\.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/{ID}/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/{ID}/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/{ID}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/{ID}/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/{ID}/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/{ID}/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/{ID}/kerberos', 'tenant_region_scope': 'OC', '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: 0fb5111f-75bb-4d77-aaa5-9cac1507eee1
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/{SUBSCRIPTION}/resourceGroups/{RESOURCEGROUP}/providers/Microsoft.HybridCompute/machines?api-version=2023-10-03-preview'
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': '0e4b7695-ba39-11ee-95ce-300505d299d3'
cli.azure.cli.core.sdk.policies:     'CommandName': 'connectedmachine list'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--resource-group --subscription --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.56.0 (MSI) (AAZ) azsdk-python-core/1.28.0 Python/3.11.5 (Windows-10-10.0.19045-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/{SUBSCRIPTION}/resourceGroups/{RESOURCEGROUP}/providers/Microsoft.HybridCompute/machines?api-version=2023-10-03-preview HTTP/1.1" 200 None
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:     'Transfer-Encoding': 'chunked'
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': '11998'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '5c0e1c86-cdb2-425d-804c-8ea73a6bbac7'
cli.azure.cli.core.sdk.policies:     'Server': 'Kestrel'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': 'f21a63af-2636-44ab-86bf-b35fa5501f98'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'AUSTRALIASOUTHEAST:20240123T214752Z:f21a63af-2636-44ab-86bf-b35fa5501f98'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'Date': 'Tue, 23 Jan 2024 21:47:51 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"value":[{"id":"{CONTENT REMOVED}"
,"nextLink":"https://management.azure.com/subscriptions/{SUBSCRIPTION}/resourceGroups/{RESOURCEGROUP}/providers/Microsoft.HybridCompute/machines?api-version=2023-10-03-preview&$skipToken=%5B%7B%22token%22%3A%22%{TOKEN},%22range%22%3A%7B%22min%22%3A%2205C1DFFFFFFFFC%22,%22max%22%3A%22FF%22%7D%7D%5D"}
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 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 710, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 87, in __next__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 43, in __next__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 250, in executor_wrapper
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 58, in _execute_operations
    self.MachinesListByResourceGroup(ctx=self.ctx)()
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 81, in __call__
    return self.on_200(session)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 138, in on_200
    self.ctx.set_var(
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 84, in set_var
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 48, in process_data
azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'str'>, got 0 (<class 'int'>)

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: Expect <class 'str'>, got 0 (<class 'int'>)
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 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 710, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 87, in __next__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 43, in __next__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 250, in executor_wrapper
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 58, in _execute_operations
    self.MachinesListByResourceGroup(ctx=self.ctx)()
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 81, in __call__
    return self.on_200(session)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 138, in on_200
    self.ctx.set_var(
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 84, in set_var
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 48, in process_data
azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'str'>, got 0 (<class 'int'>)
az_command_data_logger: Expect <class 'str'>, got 0 (<class 'int'>)
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 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 710, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 87, in __next__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 43, in __next__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 250, in executor_wrapper
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 58, in _execute_operations
    self.MachinesListByResourceGroup(ctx=self.ctx)()
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 81, in __call__
    return self.on_200(session)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\{USER}\.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine\_list.py", line 138, in on_200
    self.ctx.set_var(
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 84, in set_var
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 48, in process_data
azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'str'>, got 0 (<class 'int'>)
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 0x0415D1B8>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 1.675 seconds (init: 0.472, invoke: 1.204)
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 7224 in cache
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\{USER}\.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

To provide a full list of Arc connected machines and properties such as:

PS C:\Users\{USER}}> az connectedmachine list --resource-group "{RESOURCEGROUP}" --subscription "{SUBSCRIPTION}"
[
  {
    "adFqdn": "SERVER.DOMAIN",
    "agentConfiguration": {
      "configMode": "full",
      "extensionsAllowList": [],
      "extensionsBlockList": [],
      "extensionsEnabled": "true",
      "guestConfigurationEnabled": "true",
      "incomingConnectionsPorts": [],
      "proxyBypass": [],
      "proxyUrl": ""
    },
    "agentUpgrade": {
      "enableAutomaticUpgrade": false
    },
    "agentVersion": "1.33.02405.1188",
    "clientPublicKey": "",
    "cloudMetadata": {
      "provider": "N/A"
    },
    "detectedProperties": {
      "cloudprovider": "N/A",
      "coreCount": "1",
      "logicalCoreCount": "8",
      "manufacturer": "",
      "model": "",
      "mssqldiscovered": "false",
      "processorCount": "8",
      "productType": "7"
    },
    "displayName": "SERVER",
    "dnsFqdn": "SERVER.DOMAIN",
    "domainName": "DOMAIN",
    "errorDetails": [],
    "id": "/subscriptions/{SUBSCRIPTION}/resourceGroups/{RESOURCEGROUP}/providers/Microsoft.HybridCompute/machines/SERVER",
    "identity": {
      "principalId": "ID",
      "tenantId": "ID",
      "type": "SystemAssigned"
    },
    "lastStatusChange": "2024-01-23T21:01:29.7131604Z",
    "licenseProfile": {
      "esuProfile": {
        "esuEligibility": "Ineligible",
        "esuKeyState": "Inactive",
        "licenseAssignmentState": "NotAssigned",
        "serverType": "Standard"
      }
    }
  }
]

Environment Summary

PS C:\Users\rcanning> az --version
azure-cli                         2.56.0

core                              2.56.0
telemetry                          1.1.0

Extensions:
azure-devops                      0.26.0
bastion                            0.2.5
connectedmachine                   0.7.0
dataprotection                    0.11.2
init                               0.1.0
ssh                                2.0.2

Dependencies:
msal                            1.24.0b2
azure-mgmt-resource             23.1.0b2

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

Python (Windows) 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:21:31) [MSC v.1936 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

yonzhan commented 10 months ago

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

sb1975 commented 10 months ago

Hi All, how did it break suddenly ? It doesn't seem to be working for az version 2.55 either.. this is a blocker.. $ az connectedmachine list -g The command failed with an unexpected error. Here is the traceback: Expect <class 'str'>, got -1 (<class 'int'>) 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 663, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 710, in _run_job File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 87, in next File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 43, in next File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 250, in executor_wrapper File "C:\Users\sb0601.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine_list.py", line 58, in _execute_operations self.MachinesListByResourceGroup(ctx=self.ctx)() File "C:\Users\sb0601.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine_list.py", line 81, in call return self.on_200(session) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\sb0601.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine_list.py", line 138, in on_200 self.ctx.set_var( File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 84, in set_var File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 48, in process_data azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'str'>, got -1 (<class 'int'>) To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

$ az version { "azure-cli": "2.55.0", "azure-cli-core": "2.55.0", "azure-cli-telemetry": "1.1.0", "extensions": { "connectedk8s": "1.6.4", "connectedmachine": "0.7.0", "k8s-extension": "1.6.0", "managednetworkfabric": "4.2.0", "networkcloud": "2.0.0b2", "ssh": "2.0.2" } }

sb1975 commented 10 months ago

Luckily this one worked.. but sudden demise of az connectedmachine went unwarranted.. $ az resource list -g -otsv | grep machine

vedkale commented 9 months ago

@ryanjcanning @sb1975 the issue was caused by a change made to license properties for Windows which inadvertently affected the cli for Linux machines. The issue has been fixed, can you try az connectedmachine again and let me know if it works?

ryanjcanning commented 9 months ago

@vedkale Issue still exists for me, getting the same error as before.

GregoryMachin commented 8 months ago

I'm getting similar errors :

az connectedmachine list --resource-group "xxxxxxxxxxxxxxx"

The command failed with an unexpected error. Here is the traceback: Expect <class 'str'>, got 0 (<class 'int'>) 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 663, in execute File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 710, in _run_job File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 87, in next File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_paging.py", line 43, in next File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command.py", line 249, in executor_wrapper File "C:\Users\GregoryM.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine_list.py", line 58, in _execute_operations self.MachinesListByResourceGroup(ctx=self.ctx)() File "C:\Users\GregoryM.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine_list.py", line 81, in call return self.on_200(session) File "C:\Users\GregoryM.azure\cliextensions\connectedmachine\azext_connectedmachine\aaz\latest\connectedmachine_list.py", line 138, in on_200 self.ctx.set_var( File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_command_ctx.py", line 84, in set_var File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 409, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 363, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 234, in process_data File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_value.py", line 76, in setitem File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/aaz/_field_type.py", line 48, in process_data azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'str'>, got 0 (<class 'int'>) To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

$PSVersionTable

Name Value


PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Microsoft Windows 10.0.22621 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

az version { "azure-cli": "2.51.0", "azure-cli-core": "2.51.0", "azure-cli-telemetry": "1.1.0", "extensions": { "connectedmachine": "0.7.0", "ssh": "2.0.1" } }

Major Minor Build Revision


10 0 22621 0

OleKristianSkramstad commented 8 months ago

The problem persists.

Example: `az connectedmachine list --resource-group rg-arc-servers-001 --output tsv The command failed with an unexpected error. Here is the traceback: Expect <class 'str'>, got 0 (<class 'int'>) Traceback (most recent call last): File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 664, in execute raise ex File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 731, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 714, in _run_job result = list(result) ^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 87, in next return next(self._page_iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_paging.py", line 43, in next self._executor(self._next_link) File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_command.py", line 250, in executor_wrapper executor() File "/home/skramole/.azure/cliextensions/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py", line 58, in _execute_operations self.MachinesListByResourceGroup(ctx=self.ctx)() File "/home/skramole/.azure/cliextensions/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py", line 81, in call return self.on_200(session) ^^^^^^^^^^^^^^^^^^^^ File "/home/skramole/.azure/cliextensions/connectedmachine/azext_connectedmachine/aaz/latest/connectedmachine/_list.py", line 138, in on_200 self.ctx.set_var( File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_command_ctx.py", line 84, in set_var self.vars[name] = data


  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 234, in process_data
    value[key] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 409, in process_data
    value[idx] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
    self._data[idx] = item_schema.process_data(data, key=idx)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 234, in process_data
    value[key] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 234, in process_data
    value[key] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 234, in process_data
    value[key] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 234, in process_data
    value[key] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 409, in process_data
    value[idx] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 363, in __setitem__
    self._data[idx] = item_schema.process_data(data, key=idx)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 234, in process_data
    value[key] = sub_data
    ~~~~~^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_value.py", line 76, in __setitem__
    self._data[name] = attr_schema.process_data(data, key=name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/aaz/_field_type.py", line 48, in process_data
    raise AAZInvalidValueError('Expect {}, got {} ({})'.format(self.DataType, data, type(data)))
azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'str'>, got 0 (<class 'int'>)`

**Azure Cli Version Info**
`az version
{
  "azure-cli": "2.59.0",
  "azure-cli-core": "2.59.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "connectedmachine": "0.7.0"
  }
}`