Skip to main content
Version: Next

Task 03: Configure Network Security Groups

Runbook Azure

DOCUMENT CATEGORY: Runbook SCOPE: NSG configuration PURPOSE: Configure micro-segmentation for Azure Local VMs MASTER REFERENCE: Microsoft Learn - SDN Overview

Status: Active


Overview

With SDN enabled by Azure Arc, you can create and apply Network Security Groups (NSGs) to:

  • Logical Networks - Apply rules to all VMs on a network
  • VM NICs - Apply rules to specific VM network interfaces
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-azurelocal-prod-eus2
AZURE_REGIONazure.resource_group.locationeastus2

Execution Options

Create a Network Security Group

  1. Navigate to Azure PortalNetwork Security Groups
  2. Click + Create
  3. Configure:
  • Subscription: Select your subscription
  • Resource Group: Select the cluster's resource group
  • Name: e.g., nsg-azl-prod-web
  • Region: Select the cluster's region
  1. Click Review + CreateCreate

Add Security Rules

  1. Open the NSG resource
  2. Go to SettingsInbound security rules
  3. Click + Add
  4. Configure the rule:
  • Source: IP Addresses, CIDR, or Service Tag
  • Source port ranges: * (or specific)
  • Destination: IP Addresses, CIDR, or Service Tag
  • Destination port ranges: e.g., 443
  • Protocol: TCP
  • Action: Allow
  • Priority: 100-4096
  • Name: e.g., Allow-HTTPS-Inbound
  1. Click Add

Associate NSG with Logical Network

  1. Navigate to Azure ArcAzure Local → your cluster
  2. Go to NetworkingLogical Networks
  3. Select the target logical network
  4. Under Settings, select Network Security Group
  5. Choose the NSG to associate
  6. Click Save

Associate NSG with VM NIC

  1. Navigate to Azure ArcAzure LocalVirtual 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

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 NSG Rules

# Azure CLI
az network nsg rule list --resource-group rg-azurelocal-prod --nsg-name nsg-azl-prod-web -o table

Verify NSG Association

  1. Navigate to Azure PortalAzure ArcAzure Local
  2. Check Logical Networks for NSG association
  3. Check Virtual MachinesNetworking 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

PreviousUpNext
← Task 02: Enable SDN IntegrationPhase 01: SDN DeploymentPhase 02: Monitoring & Observability →

VersionDateAuthorChanges
1.0.02026-03-24Azure Local Cloudnology TeamInitial release