Azure / Azure/azure-cli

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

Open
#27,981 15 comments 0 reactions 0 assignees View on GitHub
act-quality-productivity-squad Auto-Assign Auto-Resolve customer-reported Network Network - Bastion question Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### 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](https://learn.microsoft.com/en-us/azure/bastion/vm-upload-download-native#rdp) 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 "" --resource-group "" --target-resource-id ""`

### 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
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//.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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.