Skip to main content
Version: 1.0.0

Task 07 — Configure Network Security Groups

Implementation Phase 06

DOCUMENT CATEGORY: Implementation Runbook — Task SCOPE: Phase 06 — Post-Deployment | Azure Local PURPOSE: Create NSGs that will be associated with logical networks in Task 08 MASTER REFERENCE: Network Security Groups PREREQUISITE: SDN must be enabled (Task 01)

Status: Active

Overview

With SDN enabled (Task 01), Network Security Groups provide micro-segmentation for Azure Local VMs. NSGs must be created before logical networks so they can be associated at logical network creation time (Task 08) using the --network-security-group parameter.

Scope Limitation

NSGs only apply to Azure Local VMs deployed from Azure interfaces (Azure Portal, Azure CLI, ARM Templates).

NSGs do NOT apply to:

  • Hyper-V VMs deployed locally
  • VMs managed by SCVMM
  • AKS workloads

NSG Concepts

Rule Components

ComponentDescription
Priority100-4096 (lower = higher priority)
DirectionInbound or Outbound
SourceIP address, CIDR, Service Tag, or *
DestinationIP address, CIDR, Service Tag, or *
ProtocolTCP, UDP, ICMP, or *
PortSingle port, range, or *
ActionAllow or Deny

Default Rules

NSGs include implicit default rules:

  • AllowVnetInBound (Priority 65000) — Allow intra-VNet traffic
  • AllowAzureLoadBalancerInBound (Priority 65001) — Allow health probes
  • DenyAllInBound (Priority 65500) — Deny all other inbound
  • AllowVnetOutBound (Priority 65000) — Allow outbound to VNet
  • AllowInternetOutBound (Priority 65001) — Allow outbound to Internet
  • DenyAllOutBound (Priority 65500) — Deny all other outbound

Variables from variables.yml

VariableConfig PathExample
AZURE_SUBSCRIPTION_IDazure.subscription.id00000000-0000-0000-0000-000000000000
AZURE_RESOURCE_GROUPazure.resource_group.namerg-iic-platform-01
AZURE_REGIONazure.resource_group.locationeastus2
CUSTOM_LOCATIONcompute.azure_local.custom_location/subscriptions/.../customLocations/cl-iic-clus01
NSG definitionsnetworking.nsgs[]See config/variables.example.yml

IIC NSG Design

Three NSGs aligned with the IIC logical networks:

nsg-iic-management

For ln-iic01-management-100 — admin access only from management CIDR.

RulePriorityDirectionPortSourceAction
Allow-RDP-Management100Inbound338910.100.0.0/24Allow
Allow-WinRM110Inbound5985-598610.100.0.0/24Allow
Allow-SSH120Inbound2210.100.0.0/24Allow
Allow-HTTPS-WAC130Inbound44310.100.0.0/24Allow
Deny-All-Inbound4000Inbound**Deny

nsg-iic-production

For ln-iic01-production-200 — web traffic from any, RDP from management only.

RulePriorityDirectionPortSourceAction
Allow-HTTPS100Inbound443*Allow
Allow-HTTP110Inbound80*Allow
Allow-RDP-Management200Inbound338910.100.0.0/24Allow
Deny-All-Inbound4000Inbound**Deny

nsg-iic-avd

For ln-iic01-avd-300 — RDP from management, outbound for AVD agent.

RulePriorityDirectionPortSourceAction
Allow-RDP-Internal100Inbound338910.100.0.0/24Allow
Allow-AVD-Agent110Outbound443*Allow
Deny-All-Inbound4000Inbound**Deny

Execution Options

Create a Network Security Group

  1. Navigate to Azure PortalAzure ArcAzure Local → your cluster
  2. Go to NetworkingNetwork Security Groups
  3. Click + Create
  4. Configure:
    • Name: nsg-iic-management
    • Custom Location: Select the cluster's custom location
  5. Click Review + CreateCreate

Add Security Rules

  1. Open the NSG resource
  2. Go to SettingsInbound security rules
  3. Click + Add
  4. Configure each rule per the tables above
  5. Click Add

Repeat for nsg-iic-production and nsg-iic-avd.

tip

NSGs will be associated with logical networks in Task 08 — Logical Network Creation.


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

Verification

List NSGs

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

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

Day 2 Operations

For ongoing NSG management (adding/removing rules, associating/dissociating from networks, troubleshooting), see Phase 01: SDN Operations — Task 02: Configure NSGs.



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

Troubleshooting

IssuePossible CauseResolution
Configuration failsIncorrect parametersVerify variable values in variables.yml
Permission deniedInsufficient RBAC roleCheck Azure role assignments
← PreviousTask 06 — VM Image Downloads
↑ Phase IndexPhase 06 — Post-Deployment Index
→ NextTask 08 — Logical Network Creation

Version Control

VersionDateAuthorChanges
1.0.02025-07-25Azure Local CloudInitial release — NSG creation before logical networks