Azure / Azure/azure-cli-extensions

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

Open
#4,568 12 comments 1 reaction 0 assignees View on GitHub
Auto-Assign customer-reported feature-request needs-team-attention Network Network - Bastion Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

- If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at [Azure/azure-cli](https://github.com/Azure/azure-cli/issues)

### **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.

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.