Azure / Azure/azure-cli

While creating tunnel using az cli, getting below error

Open
#30,821 7 comments 0 reactions 0 assignees View on GitHub
act-quality-productivity-squad Auto-Assign bug customer-reported Network - Bastion Possible-Solution Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

az network bastion tunnel --name vnet-adec-access-bastion --resource-group rg-adec-access --target-resource-id /subscriptions/025a356c-1868-4a48-90ef-47f999a99c53/resourceGroups/rg-adec-opslab/providers/Microsoft.Compute/virtualMachines/vm-adec-ops-t01 --resource-port 22 --port 22
Preview version of extension is disabled by default for extension installation, enabled for modules without stable versions.
Please run 'az config set extension.dynamic_install_allow_preview=true or false' to config it specifically.
The command requires the extension bastion. Do you want to install it now? The command will continue to run after the extension is installed. (Y/n): Y
Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
The command failed with an unexpected error. Here is the traceback:
[Errno 13] Permission denied
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.69.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.69.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.69.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.69.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.69.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.69.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/Users/sunilangane/.azure/cliextensions/bastion/azext_bastion/custom.py", line 470, in create_bastion_tunnel
tunnel_server = _get_tunnel(cmd, bastion, bastion_endpoint, target_resource_id, resource_port, port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sunilangane/.azure/cliextensions/bastion/azext_bastion/custom.py", line 429, in _get_tunnel
tunnel_server = TunnelServer(cmd.cli_ctx, "localhost", port, bastion, bastion_endpoint, vm_id, resource_port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sunilangane/.azure/cliextensions/bastion/azext_bastion/tunnel.py", line 64, in __init__
self.sock.bind((self.local_addr, self.local_port))
PermissionError: [Errno 13] Permission denied
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

### Related command

az network bastion tunnel --name vnet-adec-access-bastion --resource-group rg-adec-access --target-resource-id /subscriptions/025a356c-1868-4a48-90ef-47f999a99c53/resourceGroups/rg-adec-opslab/providers/Microsoft.Compute/virtualMachines/vm-adec-ops-t01 --resource-port 22 --port 22

### Errors

az network bastion tunnel --name vnet-adec-access-bastion --resource-group rg-adec-access --target-resource-id /subscriptions/025a356c-1868-4a48-90ef-47f999a99c53/resourceGroups/rg-adec-opslab/providers/Microsoft.Compute/virtualMachines/vm-adec-ops-t01 --resource-port 22 --port 22
Preview version of extension is disabled by default for extension installation, enabled for modules without stable versions.
Please run 'az config set extension.dynamic_install_allow_preview=true or false' to config it specifically.
The command requires the extension bastion. Do you want to install it now? The command will continue to run after the extension is installed. (Y/n): Y
Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
The command failed with an unexpected error. Here is the traceback:
[Errno 13] Permission denied
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.69.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.69.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.69.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.69.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.69.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.69.0/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/Users/sunilangane/.azure/cliextensions/bastion/azext_bastion/custom.py", line 470, in create_bastion_tunnel
tunnel_server = _get_tunnel(cmd, bastion, bastion_endpoint, target_resource_id, resource_port, port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sunilangane/.azure/cliextensions/bastion/azext_bastion/custom.py", line 429, in _get_tunnel
tunnel_server = TunnelServer(cmd.cli_ctx, "localhost", port, bastion, bastion_endpoint, vm_id, resource_port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sunilangane/.azure/cliextensions/bastion/azext_bastion/tunnel.py", line 64, in __init__
self.sock.bind((self.local_addr, self.local_port))
PermissionError: [Errno 13] Permission denied
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

### Issue script & Debug output

az network bastion tunnel --name vnet-adec-access-bastion --resource-group rg-adec-access --target-resource-id /subscriptions/025a356c-1868-4a48-90ef-47f999a99c53/resourceGroups/rg-adec-opslab/providers/Microsoft.Compute/virtualMachines/vm-adec-ops-t01 --resource-port 22 --port 22

### Expected behavior

Tunnel should create

### Environment Summary

azure-cli 2.69.0

### Additional context

Please help

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.