azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az network bastion cannot connect with native client.

Open YuKogasaka opened this issue 5 years ago • 17 comments

In #19240, I recognizes that Azure Bastion native client is supported, but running the command doesn't work. Would like to know if it is a potential bug, a limited offer, or a mistake in the command option argument.

Describe the bug

Command Name az network bastion ssh and az network bastion rdp

Errors: When I run az network bastion ssh, I get the following message and cannot connect through Bastion.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/custom.py", line 7757, in _start_tunnel
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 183, in start_server
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 118, in _listen
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 105, in _get_auth_token
msrestazure.azure_exceptions.CloudError: Tunneling is disabled

Bastion-ssh-connect

When I run az network bastion rdp, I get the following dialog box and cannot connect through Bastion.

Bastion-rdp-connect

To Reproduce: An error will occur when you execute a command that includes the following command options.

  • az network bastion ssh --name {} --resource-group {} --target-resource-id {} --auth-type {} --username {} --resource-port 22 --verbose
  • az network bastion rdp --name {} --resource-group {} --target-resource-id {} --resource-port 3389 --verbose

Expected Behavior When I execute az network bastion ssh or az network bastion rdp, will be able to login and operate through Bastion.

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.28.0

Extensions:
azure-firewall 0.12.0
ssh 0.1.6
stream-analytics 0.1.0

YuKogasaka avatar Sep 08 '21 06:09 YuKogasaka

network

yonzhan avatar Sep 08 '21 06:09 yonzhan

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.

Issue Details

In #19240, I recognizes that Azure Bastion native client is supported, but running the command doesn't work. Would like to know if it is a potential bug, a limited offer, or a mistake in the command option argument.

Describe the bug

Command Name az network bastion ssh and az network bastion rdp

Errors: When I run az network bastion ssh, I get the following message and cannot connect through Bastion.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/custom.py", line 7757, in _start_tunnel
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 183, in start_server
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 118, in _listen
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 105, in _get_auth_token
msrestazure.azure_exceptions.CloudError: Tunneling is disabled

Bastion-ssh-connect

When I run az network bastion rdp, I get the following dialog box and cannot connect through Bastion.

Bastion-rdp-connect

To Reproduce: An error will occur when you execute a command that includes the following command options.

  • az network bastion ssh --name {} --resource-group {} --target-resource-id {} --auth-type {} --username {} --resource-port 22 --verbose
  • az network bastion rdp --name {} --resource-group {} --target-resource-id {} --resource-port 3389 --verbose

Expected Behavior When I execute az network bastion ssh or az network bastion rdp, will be able to login and operate through Bastion.

Environment Summary

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.28.0

Extensions:
azure-firewall 0.12.0
ssh 0.1.6
stream-analytics 0.1.0
Author: kogesaka
Assignees: aavalang, kairu-ms
Labels:

Network, Service Attention, customer-reported

Milestone: Backlog

ghost avatar Sep 08 '21 08:09 ghost

@aavalang, Could you help with this issue? Thanks.

kairu-ms avatar Sep 08 '21 08:09 kairu-ms

This command is actually behind a feature flag for the bastion called Tunneling. Let me update the error returned. Also, note that the feature is in preview.

aavalang avatar Sep 09 '21 04:09 aavalang

@aavalang, Thank you for comment.

What feature name should I register to enable the 'Tunneling' feature tag in Bastion? I ran the following command, but couldn't see any features related to 'Tunneling'.

az feature list --namespace 'Microsoft.Network' --output table

YuKogasaka avatar Sep 09 '21 05:09 YuKogasaka

We've not yet rolled out the feature for public preview

aavalang avatar Sep 09 '21 06:09 aavalang

@aavalang, Thanks. I want to try it because it was a feature wanted in Bastion, but I'll wait for the opportunity to make it available in public preview.

YuKogasaka avatar Sep 09 '21 06:09 YuKogasaka

The feature is now in Public Preview and we are also getting the same error.

Native Client is enabled in Azure Portal. AZ CLI is at 2.30. We've followed the directions at https://docs.microsoft.com/en-ca/azure/bastion/connect-native-client-windows

@aavalang Is there anything else we should do to make it work?

VitalyMCT avatar Dec 03 '21 01:12 VitalyMCT

@VitalyMCT the feature works with CLI with az CLI version 2.29 and az ssh extension at 0.1.5.

There was a breaking change from 2.29 to 2.30 that broke this. Please downgrade to the versions mentioned above if you want to make it work.

aavalang avatar Dec 03 '21 02:12 aavalang

@aavalang Thanks for your prompt response.

So the documentation is incorrect then, because it states:

Prerequisites ... before you begin, verify that you have met the following criteria ... the latest version of the CLI commands (version 2.30 or later) is installed.

Perhaps the documentation can be kept more accurate / up to date with the required CLI versions? Also, is there any way to track the status of the regression that you've mentioned was introduced into 2.30?

I am frankly a little hesitant to downgrade AZ CLI to workaround this bug, because that may in turn cause issues with other CLI commands.

VitalyMCT avatar Dec 03 '21 03:12 VitalyMCT

@aavalang az-bastion-ssh works for me with version 2.31.

bobbyc avatar Dec 08 '21 03:12 bobbyc

The rdp command is still throwing an exception on 2.31. I did not try ssh. Here's the exception with the line numbers:

image

VitalyMCT avatar Dec 08 '21 03:12 VitalyMCT

@VitalyMCT looks like TUnneling is not enabled on your bastion. You should be able to enable it from the configuration page of the Bastion on the azure portal. Please reach out if you are still blocked.

aavalang avatar Dec 09 '21 23:12 aavalang

@aavalang Are you referring to the setting in the screenshot below? It's already enabled.

image

I am going by the instructions at https://docs.microsoft.com/en-ca/azure/bastion/connect-native-client-windows and believe everything is configured per them.

VitalyMCT avatar Dec 09 '21 23:12 VitalyMCT

if you have enabled tunneling, you should not get the message shown above. Unless its not been enabled right. Can you please send some details of your bastion? (customer sub id, location, resource group name)

aavalang avatar Dec 13 '21 17:12 aavalang

Sure, I've just emailed you these details.

Update: Just tried the same RDP command as in the documentation, which was not working as recently as December 9th. It works now. No changes to AZ CLI, Bastion configuration, destination VM or anything else on our end. There must've been some kind of an update in Azure that made it work.

VitalyMCT avatar Dec 13 '21 18:12 VitalyMCT

Same issue here:

PS C:\WINDOWS\system32> $prefix="cptdafsync" PS C:\WINDOWS\system32> $vmid=az vm show -g $prefix -n $prefix --query id -o tsv PS C:\WINDOWS\system32> az network bastion rdp -n $prefix -g $prefix --target-resource-id $vmid Command group 'network bastion' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus Exception in thread Thread-1 (_start_tunnel): Traceback (most recent call last): File "threading.py", line 1009, in _bootstrap_inner File "threading.py", line 946, in run File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/custom.py", line 8482, in _start_tunnel File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 184, in start_server File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 117, in _listen File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/tunnel.py", line 104, in _get_auth_token msrestazure.azure_exceptions.CloudError: Tunneling is disabled PS C:\WINDOWS\system32>

PS C:\WINDOWS\system32> az version { "azure-cli": "2.37.0", "azure-cli-core": "2.37.0", "azure-cli-telemetry": "1.0.6", "extensions": { "account": "0.2.1", "ad": "0.1.0", "alias": "0.5.2", "application-insights": "0.1.14", "azure-devops": "0.22.0", "cli-translator": "0.3.0", "costmanagement": "0.1.1", "interactive": "0.4.5", "internet-analyzer": "0.1.0rc6", "kusto": "0.4.0", "log-analytics": "0.2.2", "portal": "0.1.2", "resource-graph": "2.1.0", "sentinel": "0.1.1", "ssh": "1.0.0", "storage-blob-preview": "0.6.1", "storagesync": "0.1.2" } }

Any way to get this solved in the near future?

cpinotossi avatar May 25 '22 05:05 cpinotossi