Skip to content

Commit

Permalink
Make configure option work for disable gateway/ ip connect scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
Tejaswikandula committed Aug 20, 2024
1 parent d699c62 commit 3aae9e1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/bastion/azext_bastion/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,21 @@ def rdp_bastion_host(cmd, target_resource_id, target_ip_address, resource_group_
t = threading.Thread(target=_start_tunnel, args=(tunnel_server,))
t.daemon = True
t.start()
command = [_get_rdp_path(), f"/v:localhost:{tunnel_server.local_port}"]

rdp_file_content = (
f"full address:s:localhost:{tunnel_server.local_port}\n"
f"alternate full address:s:localhost:{tunnel_server.local_port}\n"
"use multimon:i:1\n"
)

rdpfilepath = os.path.join(tempfile.gettempdir(), f'conn_{uuid.uuid4().hex}.rdp')
with open(rdpfilepath, 'w') as rdp_file:
rdp_file.write(rdp_file_content)

command = [_get_rdp_path()]
if configure:
command.append("/edit")
command.append(rdpfilepath)
launch_and_wait(command)
tunnel_server.cleanup()
else:
Expand Down

0 comments on commit 3aae9e1

Please sign in to comment.