Cannot import name 'WinDLL' from 'ctypes' in macOS
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Describe the bug
I cannot connect to bastion rdp on macOS.
Mac, PS, AZ Clie and Python all are up-to-date
### Related command
az network bastion rdp --name "name" --resource-group "resource_group" --target-resource-id "target_resource_id" --enable-mfa --configure
### Errors
The command failed with an unexpected error. Here is the traceback:
cannot import name 'WinDLL' from 'ctypes' (/opt/homebrew/Cellar/python@3.12/3.12.11/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ctypes/__init__.py)
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.74.0/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.74.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.74.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.74.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.74.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.74.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/Users/qtc/.azure/cliextensions/bastion/azext_bastion/custom.py", line 285, in rdp_bastion_host
from ._process_helper import launch_and_wait
File "/Users/qtc/.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.12/3.12.11/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ctypes/__init__.py)
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
### Issue script & Debug output
Will provide upon request
### Expected behavior
That an RDP session opens using installed macOS Windows App as do other .rdp files and commands
### Environment Summary
azure-cli 2.74.0
core 2.74.0
telemetry 1.1.0
Extensions:
bastion 1.4.0
Dependencies:
msal 1.32.3
azure-mgmt-resource 23.3.0
Python location '/opt/homebrew/Cellar/azure-cli/2.74.0/libexec/bin/python'
Config directory '/Users/qtc/.azure'
Extensions directory '/Users/qtc/.azure/cliextensions'
Python (Darwin) 3.12.11 (main, Jun 3 2025, 15:41:47) [Clang 17.0.0 (clang-1700.0.13.3)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.