Skip to content

az network bastion tunnel - Localhost tunnel only - Add ability to listen on IP or Any IP address. #4568

@Hyper200

Description

@Hyper200
  • If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at Azure/azure-cli

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az network bastion tunnel

Errors:

The command failed with an unexpected error. Here is the traceback:
invalid literal for int() with base 10: '0.0.0.0:54321'
Traceback (most recent call last):
  File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/network/custom.py", line 8212, in create_bastion_tunnel
    tunnel_server = get_tunnel(cmd, resource_group_name, bastion_host_name, target_resource_id, resource_port, port)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/network/custom.py", line 8198, in get_tunnel
    tunnel_server = TunnelServer(cmd.cli_ctx, 'localhost', port, bastion, vm_id, resource_port)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/command_modules/network/tunnel.py", line 43, in __init__
    self.local_port = int(local_port)
ValueError: invalid literal for int() with base 10: '0.0.0.0:54321'

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 tunnel --name bas-defra-prod-uks-01 --resource-group RG-UKS-DEFRA-PROD-01 --target-resource-id ########## --resource-port "3389" --port "0.0.0.0:54321"

Expected Behavior

Environment Summary

Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-glibc2.29, Ubuntu 20.04.3 LTS
Python 3.8.12
Installer: DEB

azure-cli 2.34.1

Extensions:
azure-firewall 0.3.0
image-copy-extension 0.2.8

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context


I use azure cli via WSL in ubuntu, unfortunately the following command does not work

az network bastion tunnel --name bas-defra-prod-uks-01 --resource-group RG-UKS-DEFRA-PROD-01 --target-resource-id --resource-port "3389" --port "0.0.0.0:54321

Presumable this is because it is expecting a port only, the issue here is i want to use the RDP client on windows, which would go via the tunnel in wsl via the WSL IP.

The --port by default will listen on localhost only, can this be updated to allow to set an IP address as shown in the exmaple above? as this allows for WSL port forwarding.

Thanks,

Joe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botNetworkNetwork - BastionService AttentionThis issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-requestThis issue requires a new behavior in the product in order be resolved.needs-team-attentionThis issue needs attention from Azure service team or SDK team

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions