azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

Errors attempting to login using az ssh

Open gilfreund opened this issue 2 years ago • 2 comments

Trying to login using az ssh. Worked in the past. Now asked to login (which I did) and then got the message below.

Command Name az ssh vm Extension Name: ssh. Version: 0.1.5.

Errors:

The command failed with an unexpected error. Here is the traceback:
'Profile' object has no attribute 'get_msal_token'
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.30.0/libexec/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/Users/gilf/.azure/cliextensions/ssh/azext_ssh/custom.py", line 21, in ssh_vm
    _do_ssh_op(cmd, resource_group_name, vm_name, ssh_ip,
  File "/Users/gilf/.azure/cliextensions/ssh/azext_ssh/custom.py", line 48, in _do_ssh_op
    cert_file, username = _get_and_write_certificate(cmd, public_key_file, None)
  File "/Users/gilf/.azure/cliextensions/ssh/azext_ssh/custom.py", line 58, in _get_and_write_certificate
    _, certificate = profile.get_msal_token(scopes, data)
AttributeError: 'Profile' object has no attribute 'get_msal_token'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az ssh vm --name {} --resource-group {}

Expected Behavior

Log in to the remote VM

Environment Summary

macOS-12.0.1-x86_64-i386-64bit, Darwin 21.1.0
Python 3.9.7
Installer: HOMEBREW

azure-cli 2.30.0

Extensions:
ssh 0.1.5

Additional Context

gilfreund avatar Nov 11 '21 09:11 gilfreund

route to service team

yonzhan avatar Nov 11 '21 14:11 yonzhan

@gilfreund This issue should have been fixed on more recent versions of the extension. Please run "az extension update --name ssh".

vthiebaut10 avatar Jul 05 '22 17:07 vthiebaut10

Looks good

gilfreund avatar Oct 18 '22 08:10 gilfreund