question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bastion rdp using azure cli

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az network bastion rdp

Errors:

The command failed with an unexpected error. Here is the traceback:
cannot import name 'WinDLL' from 'ctypes' (/usr/lib/python3.9/ctypes/__init__.py)
Traceback (most recent call last):
  File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/network/custom.py", line 8396, in rdp_bastion_host
    from ._process_helper import launch_and_wait
  File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/network/_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' (/usr/lib/python3.9/ctypes/__init__.py)

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 network bastion rdp --name {} --resource-group {} --target-resource-id {}

Expected Behavior

Environment Summary

Linux-5.4.0-1090-azure-x86_64-with-glibc2.35 (Cloud Shell), CBL-Mariner/Linux
Python 3.9.13
Installer: RPM

azure-cli 2.40.0

Extensions:
ai-examples 0.2.5
ml 2.7.1
ssh 1.1.2

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
navba-MSFTcommented, Sep 23, 2022

@mfmalto Thanks for getting back. I see that you are now getting the below error:

Request to EncodingReservedUnitTypes v2 API endpoint failed.

If you are getting this error, You need to open the concerned Azure Bastion Configuration setting in Azure Portal —> Enable the Native Client support (as highlighted in below screenshot):

image

1reaction
mfmaltocommented, Sep 22, 2022

im having the issue whether i run it from my laptop running from a windows terminal admin console with powershell or from a cloudshell on azure or the cli in terminal locally.

i think there may of been a different error when i do it from powershell locally. it doesnt like rdp command option. ill check and get back to you.

On Sep 22, 2022, at 04:51, navba-MSFT @.***> wrote:

ALERT: This email originated from outside of Children’s. DO NOT click links or open attachments unless you recognize and/or trust the sender. Forward suspicious emails to @.*** @.***>

@mfmaltohttps://github.com/mfmalto Could you please confirm if you are running this from a cloudshell on Linux ? If Yes, it wont be able to open the RDP on your local machine. For this reason, we recommend using powershell with az cli (on Windows machine).

Also, note that RDP command works best on Windows, for other OS’ (like Linux) you can do the tunnel commandhttps://docs.microsoft.com/en-us/azure/bastion/connect-native-client-windows#connect-tunnel and then use the client of your choice.

Connect to a VM using the az network bastion tunnel commandhttps://docs.microsoft.com/en-us/azure/bastion/connect-native-client-windows#connect-tunnel. This lets you do the following:

  • Use native clients on non-Windows local computers (example: a Linux PC).
  • Use the native client of your choice. (This includes the Windows native client.)
  • Connect using SSH or RDP.
  • Set up concurrent VM sessions with Bastion.
  • Upload fileshttps://docs.microsoft.com/en-us/azure/bastion/vm-upload-download-native#tunnel-command to your target VM from your local computer. File download from the target VM to the local client is currently not supported for this command.

Currently, this feature has the following limitation:

Signing in using an SSH private key stored in Azure Key Vault isn’t supported with this feature. Before signing in to your Linux VM using an SSH key pair, download your private key to a file on your local machine.

Hope this helps.

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-cli/issues/23965#issuecomment-1254722200, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYHWPI3WOYDDPRL5KIFERBDV7QMXNANCNFSM6AAAAAAQSMGF3E. You are receiving this because you were mentioned.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect to a VM using a native client and Azure Bastion
The native client feature lets you connect to your target VMs via Bastion using Azure CLI, and expands your sign-in options to include...
Read more >
Azure Bastion: Use Native RDP Client to Connect to VMs
Connect to Windows VM using Native RDP Client · Open a PowerShell 7 command prompt. · Use the az login command to log...
Read more >
Azure Bastion Native Client Support With the Windows RDP ...
Azure Bastion native client support provides a secure way to log into Windows and Linux virtual machines (VMs) using the Remote Desktop ......
Read more >
Azure Bastion with native tools & AAD
Azure Bastion's native client access is a far better way of accessing your Azure virtual machines. Rich functionality, improved copy and paste and...
Read more >
Connect to Bastion Using RDP (No Port TCP 3389 Required ...
Azure Bastion provides secure RDP and SSH connectivity to all of the VMs in the virtual network in which it is provisioned.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found