Skip to content

Windows RDP via Bastian using AZ network CLI from Mac won't work #27981

@DewangS

Description

@DewangS

Describe the bug

We have a windows VM in our private subnet in Azure. In order to do file transfer between Mac and the VM, we are using these instructions on Mac. When we run the last command az network bastion rdp --name "" --resource-group "" --target-resource-id "" to open an RDP session, we get an exception with first 2 lines as ...

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
The command failed with an unexpected error. Here is the traceback:

Related command

az network bastion rdp --name "<BastionName>" --resource-group "<BastionResourceGroupName>" --target-resource-id "<VMResourceId>"

Errors

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
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.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py)
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.54.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.54.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.54.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.54.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.54.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.54.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/30053320/.azure/cliextensions/bastion/azext_bastion/custom.py", line 235, in rdp_bastion_host
    from ._process_helper import launch_and_wait
  File "/Users/30053320/.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.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ctypes/__init__.py)
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

az network bastion rdp --name "" --resource-group "" --target-resource-id ""

Please note, all variable substitutions were made as per our environment in the above command

Expected behavior

Expected to open and RDP session with a prompt to login to the session. Our Windows desktop\laptop users had no issues using this same command so, I suspect this has something to do with Mac.

Environment Summary

azure-cli                         2.54.0 *

core                              2.54.0 *
telemetry                          1.1.0

Extensions:
bastion                            0.3.0

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

Python location '/opt/homebrew/Cellar/azure-cli/2.54.0/libexec/bin/python'
Extensions directory '/Users/<userid>/.azure/cliextensions'

Python (Darwin) 3.11.6 (main, Nov  2 2023, 04:39:43) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Additional context

is this feature i.e. opening an RDP session to a windows VM using AZ CLI from Mac's terminal available?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botNetworkaz network vnet/lb/nic/dns/etc...Network - BastionService AttentionThis issue is responsible by Azure service team.Similar-Issueact-quality-productivity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions