Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def build_nic_resource(_, name, location, tags, vm_name, subnet_id, private_ip_a
return nic


def build_nsg_resource(_, name, location, tags, nsg_rule):
def build_nsg_resource(cmd, name, location, tags, nsg_rule):
nsg = {
'type': 'Microsoft.Network/networkSecurityGroups',
'name': name,
Expand All @@ -203,7 +203,7 @@ def build_nsg_resource(_, name, location, tags, nsg_rule):
'dependsOn': []
}

if nsg_rule != 'NONE':
if nsg_rule != 'NONE' and not cmd.cli_ctx.config.getboolean('vm', 'disable_nsg_rule', fallback=False):
rule_name = 'rdp' if nsg_rule == 'RDP' else 'default-allow-ssh'
rule_dest_port = '3389' if nsg_rule == 'RDP' else '22'

Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3016,7 +3016,7 @@ def _get_public_ip_address_allocation(value, sku):
if load_balancer_sku and load_balancer_sku.lower() == 'standard' and nsg is None and os_type:
nsg_name = '{}NSG'.format(vmss_name)
master_template.add_resource(build_nsg_resource(
None, nsg_name, location, tags, 'rdp' if os_type.lower() == 'windows' else 'ssh'))
cmd, nsg_name, location, tags, 'rdp' if os_type.lower() == 'windows' else 'ssh'))
nsg = "[resourceId('Microsoft.Network/networkSecurityGroups', '{}')]".format(nsg_name)
vmss_dependencies.append('Microsoft.Network/networkSecurityGroups/{}'.format(nsg_name))

Expand Down
Loading