Closed emailstorbala closed 1 month ago
Hi @emailstorbala,
This is not the official Azure CLI published by Microsoft.
How to tell if the installed Azure CLI is unofficial:
Please follow https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux to install Microsoft official Azure CLI.
If you feel that further discussion is needed, please add a comment with the text /clibot unresolve
to reopen the issue.
Thank you for opening this issue, we will look into it.
I am fine with the closing of this issue but Debian/testing deb package also got built from the same source code (https://github.com/Azure/azure-cli). The azure-cli version 2.6.1 definitely has issues. I rectified the issue by downgrading to 2.59.0 version. Thank you for the little help provided!
Describe the bug
~ ❯ az ssh arc --subscription "xxxxxxxxxxxxxxxxxxxx" --resource-group "ActiveDirectoryResourceGroup" --name "xxxxxxx" Error loading command module 'monitor': ord() expected string of length 1, but int found The command requires the extension ssh. Do you want to install it now? The command will continue to run after the extension is installed. (Y/n): Y Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt. Default enabled including preview versions for extension installation now. Disabled in future release. Use '--allow-preview true' to enable it specifically if needed. Use '--allow-preview false' to install stable version only. Error loading command module 'monitor': ord() expected string of length 1, but int found User 'user@company.com' does not exist in MSAL token cache. Run
az login
.Related command
az ssh arc --subscription "xxxxxxxxxxxxxxxxxxxx" --resource-group "ActiveDirectoryResourceGroup" --name "xxxxxxx"
Errors
Error loading command module 'monitor': ord() expected string of length 1, but int found User 'xxxx@test.com' does not exist in MSAL token cache. Run
az login
.This happens for almost all
az
commands likeaz
oraz -h
, etcIssue script & Debug output
DEBUG: cli.knack.cli: Command arguments: ['ssh', 'arc', '--subscription', 'aaaa-bbbb-cccc-dddd', '--resource-group', 'ActiveDirectoryResourceGroup', '--name', 'test-env', '--debug'] DEBUG: cli.knack.cli: init debug log: Cannot enable color. DEBUG: cli.knack.cli: Event: Cli.PreExecute [] DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f344b4c62a0>, <function OutputProducer.on_global_arguments at 0x7f344b214400>, <function CLIQuery.on_global_arguments at 0x7f344b23dee0>] DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] DEBUG: cli.azure.cli.core: Modules found from index for 'ssh': ['azext_ssh'] DEBUG: cli.azure.cli.core: Loading command modules: DEBUG: cli.azure.cli.core: Name Load Time Groups Commands DEBUG: cli.azure.cli.core: Total (0) 0.000 0 0 DEBUG: cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next'] DEBUG: cli.azure.cli.core: Loading extensions: DEBUG: cli.azure.cli.core: Name Load Time Groups Commands Directory DEBUG: cli.azure.cli.core: ssh 0.041 1 4 /home/user/.azure/cliextensions/ssh DEBUG: cli.azure.cli.core: Total (1) 0.041 1 4.add_subscription_parameter at 0x7f344a161a80>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f344a18b600>, <function register_cache_arguments..add_cache_arguments at 0x7f344a18b740>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f344b2144a0>, <function CLIQuery.handle_query_parameter at 0x7f344b23df80>, <function register_ids_argument..parse_ids_arguments at 0x7f344a18b6a0>]
INFO: az_command_data_logger: extension name: ssh
INFO: az_command_data_logger: extension version: 2.0.4
DEBUG: cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='/home/user/.azure/msal_token_cache.json', encrypt=False
DEBUG: cli.azure.cli.core.auth.binary_cache: load: /home/user/.azure/msal_http_cache.bin
DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
INFO: msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/86d0971b-9e9c-4adb-a67c-fe73c5d73368
DEBUG: msal.authority: openid_config("https://login.microsoftonline.com/86d0971b-9e9c-4adb-a67c-fe73c5d73368/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/86d0971b-9e9c-4adb-a67c-fe73c5d73368/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/86d0971b-9e9c-4adb-a67c-fe73c5d73368/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/86d0971b-9e9c-4adb-a67c-fe73c5d73368/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/86d0971b-9e9c-4adb-a67c-fe73c5d73368/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/86d0971b-9e9c-4adb-a67c-fe73c5d73368/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/86d0971b-9e9c-4adb-a67c-fe73c5d73368/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/86d0971b-9e9c-4adb-a67c-fe73c5d73368/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'}
DEBUG: msal.application: Broker enabled? None
DEBUG: msal.application: get_accounts(username='user@company.com') finds no account. If tokens were acquired without 'profile' scope, they would contain no username for filtering. Consider calling get_accounts(username=None) instead.
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/init.py", line 664, in execute
raise ex
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/init.py", line 731, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/init.py", line 701, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/init.py", line 334, in call
return self.handler(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(command_args)
^^^^^^^^^^^^^^^^^^
File "/home/user/.azure/cliextensions/ssh/azext_ssh/custom.py", line 150, in ssh_arc
ssh_vm(cmd, resource_group_name, vm_name, None, public_key_file, private_key_file,
File "/home/user/.azure/cliextensions/ssh/azext_ssh/custom.py", line 62, in ssh_vm
ssh_session.resource_type = resource_type_utils.decide_resource_type(cmd, ssh_session)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.azure/cliextensions/ssh/azext_ssh/resource_type_utils.py", line 44, in decide_resource_type
types_in_rg = _list_types_of_resources_with_provided_name(cmd, op_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/.azure/cliextensions/ssh/azext_ssh/resource_type_utils.py", line 19, in _list_types_of_resources_with_provided_name
resource_client = get_mgmt_service_client(cmd.cli_ctx, ResourceManagementClient)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/client_factory.py", line 83, in get_mgmt_serviceclient
client, = _get_mgmt_service_client(cli_ctx, client_type, subscription_id=subscription_id,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/client_factory.py", line 236, in _get_mgmt_service_client
credential, subscriptionid, = profile.get_login_credentials(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 357, in get_login_credentials
credential = self._create_credential(account, client_id=client_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 615, in _create_credential
return identity.get_user_credential(username_or_sp_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/auth/identity.py", line 232, in get_user_credential
return UserCredential(self.client_id, username, **self._msal_public_app_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/azure/cli/core/auth/msal_authentication.py", line 58, in init
raise CLIError("User '{}' does not exist in MSAL token cache. Run
DEBUG: cli.azure.cli.core: Loaded 1 groups, 4 commands. DEBUG: cli.azure.cli.core: Found a match in the command table. DEBUG: cli.azure.cli.core: Raw command : ssh arc DEBUG: cli.azure.cli.core: Command table: ssh arc DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f344a137420>] DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/user/.azure/commands/2024-07-02.19-29-11.ssh_arc.10470.log'. INFO: az_command_data_logger: command args: ssh arc --subscription {} --resource-group {} --name {} --debug DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.
az login
.".format(username)) knack.util.CLIError: User 'user@company.com' does not exist in MSAL token cache. Runaz login
.ERROR: cli.azure.cli.core.azclierror: User 'user@company.com' does not exist in MSAL token cache. Run
az login
. ERROR: az_command_data_logger: User 'user@company.com' does not exist in MSAL token cache. Runaz login
. DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f344a1376a0>] INFO: az_command_data_logger: exit code: 1 INFO: cli.azure.cli.main: Command ran in 0.188 seconds (init: 0.072, invoke: 0.116) INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1 INFO: telemetry.client: Accumulated 0 events. Flush the clients. INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1 INFO: telemetry.save: Save telemetry record of length 3899 in cache INFO: telemetry.main: Begin creating telemetry upload process. INFO: telemetry.process: Creating upload process: "/usr/bin/python3 /usr/lib/python3/dist-packages/azure/cli/telemetry/init.py /home/user/.azure" INFO: telemetry.process: Return from creating process INFO: telemetry.main: Finish creating telemetry upload process.Expected behavior
az ssh arc ...
command should succeed.Environment Summary
{ "azure-cli": "2.61.0", "azure-cli-core": "2.61.0", "azure-cli-telemetry": "1.1.0", "extensions": { "azure-devops": "1.0.1", "ssh": "2.0.4" } }
Additional context
This version (2.61) breaks all
az
command usages.OS : Debian/trixie Python: 3.11.9 Kernel: 6.8.12-amd64