Skip to content

https://learn.microsoft.com/en-us/azure/bastion/vm-upload-download-native doesn't work on macOS #28647

@ereli-sevenai

Description

@ereli-sevenai

Describe the bug

This page provides misleading instructionse for macOS users.
https://learn.microsoft.com/en-us/azure/bastion/vm-upload-download-native
Trying to run this command az network bastion rdp --name "YourBastionName" --resource-group "ResourceGroupName" --target-resource-id "YourVMResourceId" on macOS leads to this error

The command failed with an unexpected error. Here is the traceback:
cannot import name 'WinDLL' from 'ctypes' (/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 729, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 698, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/user/.azure/cliextensions/bastion/azext_bastion/custom.py", line 235, in rdp_bastion_host
    from ._process_helper import launch_and_wait
  File "/Users/user/.azure/cliextensions/bastion/azext_bastion/_process_helper.py", line 9, in <module>
    from ctypes import WinDLL, c_int, c_size_t, Structure, WinError, sizeof, pointer
ImportError: cannot import name 'WinDLL' from 'ctypes' (/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py)

Related command

`az network bastion rdp --name "YourBastionName" --resource-group "ResourceGroupName"

Errors

The command failed with an unexpected error. Here is the traceback:
cannot import name 'WinDLL' from 'ctypes' (/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 729, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 698, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/user/.azure/cliextensions/bastion/azext_bastion/custom.py", line 235, in rdp_bastion_host
    from ._process_helper import launch_and_wait
  File "/Users/user/.azure/cliextensions/bastion/azext_bastion/_process_helper.py", line 9, in <module>
    from ctypes import WinDLL, c_int, c_size_t, Structure, WinError, sizeof, pointer
ImportError: cannot import name 'WinDLL' from 'ctypes' (/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py)

Issue script & Debug output

az_command_data_logger: exit code: 2
cli.main: Command ran in 3.004 seconds (init: 0.084, invoke: 2.919)
cli.azure.cli.core.decorators: Suppress exception:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/main.py", line 62, in
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/main.py", line 50, in
exit_code = cli_main(az_cli, sys.argv[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/main.py", line 36, in cli_main
return cli.invoke(args)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 250, in invoke
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 589, in execute
parsed_args = self.parser.parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/knack/parser.py", line 261, in parse_args
return super().parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1869, in parse_args
args, argv = self.parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args
self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1902, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2096, in _parse_known_args
positionals_end_index = consume_positionals(start_index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2073, in consume_positionals
take_action(action, args)
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1978, in take_action
action(self, namespace, argument_values, option_string)
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1241, in call
subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/parser.py", line 281, in parse_known_args
self._namespace, self._raw_arguments = super().parse_known_args(args=args, namespace=namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1902, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2096, in _parse_known_args
positionals_end_index = consume_positionals(start_index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2073, in consume_positionals
take_action(action, args)
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 1962, in take_action
argument_values = self._get_values(action, argument_strings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/parser.py", line 272, in _get_values
value = super(AzCliCommandParser, self)._get_values(action, arg_strings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2506, in _get_values
self._check_value(action, value[0])
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/parser.py", line 337, in _check_value
self.exit(2)
File "/opt/homebrew/Cellar/python@3.11/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/argparse.py", line 2617, in exit
_sys.exit(status)
SystemExit: 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/decorators.py", line 79, in _wrapped_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/core/telemetry.py", line 532, in _get_secrets_warning_config
show_secrets_warning = _get_config().getboolean('clients', 'show_secrets_warning', fallback=None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/knack/config.py", line 147, in getboolean
raise ValueError('Not a boolean: {}'.format(val))
ValueError: Not a boolean: None

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 3611 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/bin/python /opt/homebrew/Cellar/azure-cli/2.57.0/libexec/lib/python3.11/site-packages/azure/cli/telemetry/init.py /Users/user/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

Using az cli and the Microsoft RDP client (https://apps.apple.com/us/app/microsoft-remote-desktop/id1295203466?mt=12)
I expect to be able to connect to the bastion and vm and transfer files.

Environment Summary

azure-cli                         2.57.0 *

core                              2.57.0 *
telemetry                          1.1.0

Extensions:
bastion                            0.3.0

Dependencies:
msal                              1.26.0
azure-mgmt-resource             23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.57.0/libexec/bin/python'
Extensions directory '/Users/ereli/.azure/cliextensions'

Python (Darwin) 3.11.8 (main, Feb  6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions