Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bastion] add auth type password for rdp and fix line formatting issue #7023

Merged
merged 5 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/bastion/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============
0.2.7
++++++
* add support for auth type password in RDP connection
* line formatting issue with IP connect

0.2.6
++++++
* Adding auth type aad for RDP to mimic the enable-mfa flag.
Expand Down
9 changes: 6 additions & 3 deletions src/bastion/azext_bastion/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def ssh_bastion_host(cmd, auth_type, target_resource_id, target_ip_address, reso
if ip_connect:
if int(resource_port) not in [22, 3389]:
raise UnrecognizedArgumentError("Custom ports are not allowed. Allowed ports for Tunnel with IP connect is 22, 3389.")
target_resource_id = f"/subscriptions/{get_subscription_id(cmd.cli_ctx)}/resourceGroups/{resource_group_name}"
target_resource_id = f"/subscriptions/{get_subscription_id(cmd.cli_ctx)}/resourceGroups/{resource_group_name}" \
f"/providers/Microsoft.Network/bh-hostConnect/{target_ip_address}"

_validate_resourceid(target_resource_id)
Expand Down Expand Up @@ -252,6 +252,9 @@ def rdp_bastion_host(cmd, target_resource_id, target_ip_address, resource_group_
if auth_type is None:
# do nothing
pass
elif auth_type.lower() == "password":
# do nothing
pass
elif auth_type.lower() == "aad":
enable_mfa = True

Expand All @@ -264,7 +267,7 @@ def rdp_bastion_host(cmd, target_resource_id, target_ip_address, resource_group_
if int(resource_port) not in [22, 3389]:
raise UnrecognizedArgumentError("Custom ports are not allowed. Allowed ports for Tunnel with IP connect is 22, 3389.")

target_resource_id = f"/subscriptions/{get_subscription_id(cmd.cli_ctx)}/resourceGroups/{resource_group_name}"
target_resource_id = f"/subscriptions/{get_subscription_id(cmd.cli_ctx)}/resourceGroups/{resource_group_name}" \
f"/providers/Microsoft.Network/bh-hostConnect/{target_ip_address}"

_validate_resourceid(target_resource_id)
Expand Down Expand Up @@ -379,7 +382,7 @@ def create_bastion_tunnel(cmd, target_resource_id, target_ip_address, resource_g

ip_connect = _is_ipconnect_request(bastion, target_ip_address)
if ip_connect:
target_resource_id = f"/subscriptions/{get_subscription_id(cmd.cli_ctx)}/resourceGroups/"
target_resource_id = f"/subscriptions/{get_subscription_id(cmd.cli_ctx)}/resourceGroups/" \
f"{resource_group_name}/providers/Microsoft.Network/bh-hostConnect/{target_ip_address}"

if ip_connect and int(resource_port) not in [22, 3389]:
Expand Down
2 changes: 1 addition & 1 deletion src/bastion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


# HISTORY.rst entry.
VERSION = '0.2.6'
VERSION = '0.2.7'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading