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

Azure cli command is failing with the latest version 2.61.0 in Debian/testing (trixie) #29297

Closed
emailstorbala opened this issue Jul 2, 2024 · 4 comments
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Configure az configure/config customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. SSH VM SSH

Comments

@emailstorbala
Copy link

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 '[email protected]' 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 '[email protected]' does not exist in MSAL token cache. Run az login.

This happens for almost all az commands like az or az -h, etc

Issue 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
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..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='[email protected]') 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_service_client
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, subscription_id, _ = 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 az login.".format(username))
knack.util.CLIError: User '[email protected]' does not exist in MSAL token cache. Run az login.

ERROR: cli.azure.cli.core.azclierror: User '[email protected]' does not exist in MSAL token cache. Run az login.
ERROR: az_command_data_logger: User '[email protected]' does not exist in MSAL token cache. Run az 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

@emailstorbala emailstorbala added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jul 2, 2024
Copy link

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.

@azure-client-tools-bot-prd azure-client-tools-bot-prd bot added the Auto-Resolve Auto resolve by bot label Jul 2, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Account az login/account labels Jul 2, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 2, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 2, 2024

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

@microsoft-github-policy-service microsoft-github-policy-service bot added Configure az configure/config VM SSH Service Attention This issue is responsible by Azure service team. SSH labels Jul 2, 2024
@emailstorbala
Copy link
Author

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!

@yonzhan yonzhan removed 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 Jul 3, 2024
@Phaqui
Copy link

Phaqui commented Jan 6, 2025

Similar/the same issue here for me: When trying to execute

az monitor log-analytics workspace create --resource-group xxxxx --workspace-name yyyyy

It fails, and one of the error messages does include the specific line:

Error loading command module 'monitor': ord() expected string of length 1, but int found

System is Debian sid. az cli version 2.67.0-1~bookworm.

Fixed by downgrading to 2.66.0-1~bookworm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Configure az configure/config customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. SSH VM SSH
Projects
None yet
Development

No branches or pull requests

4 participants