Skip to main content
Version: 2411

Task 02: Manage Network Security Groups

Runbook Azure

DOCUMENT CATEGORY: Runbook SCOPE: Day 2 NSG management PURPOSE: Manage NSG rules, associations, and troubleshooting for Azure Local VMs MASTER REFERENCE: SDN Network Security Groups INITIAL SETUP: See Phase 06 — Task 07: Configure NSGs

Status: Active

Overview​

This document covers Day 2 operations for NSGs that were initially created during Phase 06 — Post-Deployment Task 07 and associated with logical networks during Task 08 — Logical Network Creation.

Day 2 operations include:

  • Adding or removing security rules
  • Associating or dissociating NSGs from logical networks and VM NICs
  • Troubleshooting connectivity issues related to NSG rules

Common NSG Patterns​

Web Server NSG​

RuleDirectionPortSourceAction
Allow-HTTPSInbound443*Allow
Allow-HTTPInbound80*Allow
Allow-RDP-MgmtInbound3389Management CIDRAllow
Deny-AllInbound**Deny

Database Server NSG​

RuleDirectionPortSourceAction
Allow-SQLInbound1433App Server CIDRAllow
Allow-RDP-MgmtInbound3389Management CIDRAllow
Deny-AllInbound**Deny

Application Server NSG​

RuleDirectionPortSourceAction
Allow-App-PortInbound8080Web Server CIDRAllow
Allow-RDP-MgmtInbound3389Management CIDRAllow
Deny-AllInbound**Deny

NIC Configuration Note​

Multiple NICs on Azure Local VMs

If you provision multiple static NICs on an Azure Local VM, all NICs receive the default gateway by default.

Resolution: Remove the default gateway from secondary NICs to prevent:

  • Asymmetric networking
  • Packet loss
  • Unpredictable network behavior
# Inside the VM - remove default gateway from secondary NIC
Remove-NetRoute -InterfaceAlias "Ethernet 2" -DestinationPrefix "0.0.0.0/0" -Confirm:$false

Day 2 Operations​

Add a Rule to an Existing NSG​

az stack-hci-vm network nsg rule create \
--nsg-name nsg-iic-production \
--resource-group rg-iic-platform-01 \
--subscription <subscription-id> \
--name "Allow-SQL-AppTier" \
--priority 300 \
--direction Inbound \
--access Allow \
--protocol Tcp \
--source-address-prefixes "10.200.0.0/24" \
--source-port-ranges "*" \
--destination-address-prefixes "*" \
--destination-port-ranges "1433"

Remove a Rule​

az stack-hci-vm network nsg rule delete \
--nsg-name nsg-iic-production \
--resource-group rg-iic-platform-01 \
--subscription <subscription-id> \
--name "Allow-SQL-AppTier"

Associate NSG with VM NIC​

  1. Navigate to Azure Arc → Azure Local → Virtual Machines
  2. Select the target VM
  3. Go to Networking
  4. Select the target NIC
  5. Click Network Security Group
  6. Choose the NSG to associate
  7. Click Save

Dissociate NSG from a Logical Network​

To change or remove an NSG from a logical network, the network must be recreated. NSG association is set at logical network creation time.


NIC Configuration Note​

Multiple NICs on Azure Local VMs

If you provision multiple static NICs on an Azure Local VM, all NICs receive the default gateway by default.

Resolution: Remove the default gateway from secondary NICs to prevent:

  • Asymmetric networking
  • Packet loss
  • Unpredictable network behavior
# Inside the VM - remove default gateway from secondary NIC
Remove-NetRoute -InterfaceAlias "Ethernet 2" -DestinationPrefix "0.0.0.0/0" -Confirm:$false

Verification​

List NSG Rules​

az stack-hci-vm network nsg rule list \
--nsg-name nsg-iic-management \
--resource-group rg-iic-platform-01 \
--subscription <subscription-id> -o table

Verify NSG Association​

  1. Navigate to Azure Portal → Azure Arc → Azure Local
  2. Check Logical Networks for NSG association
  3. Check Virtual Machines → Networking for NIC NSG association

Test Connectivity​

# From a test VM, verify rules are working
Test-NetConnection -ComputerName <target-vm-ip> -Port 443
Test-NetConnection -ComputerName <target-vm-ip> -Port 3389

Troubleshooting​

IssueResolution
NSG not applyingVerify VM was deployed from Azure interfaces
Rules not blockingCheck rule priority (lower = processed first)
Connectivity lostVerify management access rules exist
NSG not visibleEnsure SDN is enabled on the cluster


When to use: Use this option for manual step-by-step execution.

See procedure steps above for manual execution guidance.

Toolkit Reference

Scripts for this task are located in the azurelocal-toolkit repository under scripts/deploy/ in the appropriate task folder.


Alternatives​

The procedures in this task use the scripted methods shown in the tabs above. Additional deployment methods including Azure CLI and Bash scripts are available in the azurelocal-toolkit repository under scripts/deploy/.

MethodDescription
Azure CLIPowerShell-based Azure CLI scripts for Azure resource operations
BashLinux/macOS compatible shell scripts for pipeline environments

Variables from variables.yml​

The following variables from \ ariables.yml\ are used by this task:

Variable PathTypeDescription
See variables.ymlVariousRefer to the variables.yml configuration file
PreviousUpNext
← Task 01: Validate PrerequisitesPhase 01: SDN OperationsPhase 02: Monitoring & Observability →

Version Control​

VersionDateAuthorChanges
1.0.02025-03-25AzureLocalInitial release
1.1.02026-04-01AzureLocalAlign naming conventions, remove consulting language
2.0.02025-07-25AzureLocalRepurpose as Day 2 management — initial creation moved to Phase 06 Task 07