
Azure Workshopz | Beyond Cloud with Chriz
DEPLOY • CONNECT • GOVERN • BREAK • DIAGNOSE • REPAIR • VERIFY
Introduction
Imagine managing an enterprise Azure environment containing dozens of subscriptions, hundreds of virtual networks and multiple application teams. Each team manages its own network security groups, virtual network peerings and connectivity requirements. Over time, maintaining consistent connectivity and security policies becomes increasingly difficult.
How can you centrally manage hundreds of virtual networks? How can you enforce security policies independently of application teams? What happens when centralized security rules conflict with local NSGs? How can you automatically establish hub-and-spoke connectivity, investigate failures and restore service?
Azure Virtual Network Manager (AVNM) provides a centralized management layer for these challenges. In this enterprise mega lab, we will build a network environment, establish centralized connectivity, enforce security admin rules, introduce configuration failures and investigate application connectivity. Everything uses Azure CLI and PowerShell 7.
Learning objectives
Deploy Azure Virtual Network Manager; configure subscription-level scope and static network groups; establish hub-and-spoke and direct spoke connectivity; deploy Allow, Deny and AlwaysAllow security admin rules; investigate NSG conflicts, membership errors, deployment drift, effective routes and rules; distinguish Azure network restrictions from guest firewall restrictions; restore a healthy enterprise configuration.
Workshop overview
Difficulty: Advanced | Duration: 3–5 hours, depending on deployment convergence | Estimated cost: Medium
Deployment: Azure CLI | Automation: PowerShell 7 | OS: Windows Server 2022
Region: West Europe | Architecture: Hub-and-spoke | Virtual networks: 3 | Virtual machines: 3
Troubleshooting scenarios: 7 | Certification relevance: AZ-700 / AZ-104 / AZ-305
Enterprise architecture
AZURE VIRTUAL NETWORK MANAGER
+------------------------------+
| Subscription Scope |
| Network Groups |
| Connectivity Configuration |
| Security Admin Configuration |
+------------------------------+
|
Centralized Management
|
+------------------------------+
| HUB VNET |
| 10.0.0.0/16 |
| VM-HUB: 10.0.1.10 |
+------------------------------+
/ \
/ \
+----------------------+ +----------------------+
| PRODUCTION SPOKE | | DEVELOPMENT SPOKE |
| 10.10.0.0/16 | | 10.20.0.0/16 |
| VM-PROD | | VM-DEV |
| 10.10.1.10 | | 10.20.1.10 |
| Production NSG | | Development NSG |
+----------------------+ +----------------------+
\ /
-----------------
Optional direct connectivityAll virtual machines use private IP addresses. Dedicated NAT gateways provide explicit outbound connectivity for Azure VM agents without exposing inbound VM ports to the internet.
IP addressing plan
Hub: 10.0.0.0/16 | Subnet: 10.0.1.0/24 | VM: 10.0.1.10
Production: 10.10.0.0/16 | Subnet: 10.10.1.0/24 | VM: 10.10.1.10
Development: 10.20.0.0/16 | Subnet: 10.20.1.0/24 | VM: 10.20.1.10
Understanding Azure Virtual Network Manager
AVNM supports management scopes, static and dynamic network groups, connectivity configurations, security admin configurations, centralized routing, network verification and IP address management. This workshop focuses on connectivity and security administration.
AVNM is a management and governance service, not a firewall appliance or a traffic-forwarding router.
Security rule evaluation
INCOMING NETWORK TRAFFIC
|
SECURITY ADMIN RULES
|
+----------------+----------------+
| | |
DENY ALLOW ALWAYS ALLOW
| | |
BLOCKED v |
NSG EVALUATION |
ALLOW / DENY |
| |
+----------------+
|
GUEST FIREWALL
|
APPLICATIONDeny: blocks matching traffic before NSG evaluation.
Allow: permits matching traffic to continue to NSG evaluation.
AlwaysAllow: permits matching traffic without further NSG evaluation.
Guest operating system firewalls and application controls still apply.
Prerequisites and cost considerations
Use a dedicated sandbox subscription with permissions to create network managers, VNets and virtual machines; PowerShell 7; Azure CLI 2.75.0 or later with the virtual-network-manager extension; sufficient regional VM quota; and no overlapping Network Manager configurations. Never deploy the deliberately disruptive configurations into production.
AVNM, Windows VMs, managed disks, three NAT gateways, standard public IPs and traffic can incur charges. The NAT gateways increase costs but provide explicit outbound access. Check regional prices, policies and quota. Delete resources after the exercise.
THE MEGA LAB
Step 1 — Prepare the PowerShell environment
Open PowerShell 7 locally or Azure Cloud Shell in PowerShell mode. Authenticate locally if necessary.
$PSVersionTable.PSVersion
az version
# If not already authenticated:
az login
az account show --query "{Name:name,Subscription:id,Tenant:tenantId}" -o table
$Subscription = Read-Host "Sandbox subscription ID"
az account set --subscription $Subscription
if ($LASTEXITCODE -ne 0) { throw "Unable to select subscription." }
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
$Extensions = az extension list --query "[].name" -o tsv
if ($Extensions -contains "virtual-network-manager") {
az extension update --name virtual-network-manager
} else {
az extension add --name virtual-network-manager
}
az network manager --help
az network manager connect-config --help
az network manager security-admin-config --helpCheck provider registration. Register if necessary and wait until registered.
az provider show --namespace Microsoft.Network --query registrationState -o tsv
az provider show --namespace Microsoft.Compute --query registrationState -o tsvStep 2 — Configure workshop variables
$Location = "westeurope"
$Suffix = [guid]::NewGuid().ToString("N").Substring(0,6)
$RG = "rg-avnm-megalab-$Suffix"
$AVNM = "avnm-enterprise-$Suffix"
$HubVNet = "vnet-hub"
$ProdVNet = "vnet-production"
$DevVNet = "vnet-development"
$SpokeGroup = "ng-spokes"
$ProdGroup = "ng-production"
$ConnectivityConfig = "cc-hubspoke"
$SecurityConfig = "sc-enterprise"
$RuleCollection = "rc-production"
$AdminRule = "hub-http-governance"
$LabDir = Join-Path $HOME "avnm-lab-$Suffix"
New-Item -ItemType Directory -Path $LabDir -Force | Out-Null
Set-Location $LabDir
$Networks = @(
@{Role="hub"; VNet=$HubVNet; CIDR="10.0.0.0/16"; Subnet="10.0.1.0/24"; IP="10.0.1.10"; VM="vm-hub"},
@{Role="prod"; VNet=$ProdVNet; CIDR="10.10.0.0/16"; Subnet="10.10.1.0/24"; IP="10.10.1.10"; VM="vm-prod"},
@{Role="dev"; VNet=$DevVNet; CIDR="10.20.0.0/16"; Subnet="10.20.1.0/24"; IP="10.20.1.10"; VM="vm-dev"}
)
az group create --name $RG --location $Location --tags Environment=Workshop Project=AVNMStep 3 — Deploy the three virtual networks
foreach ($Network in $Networks) {
az network vnet create --resource-group $RG --location $Location --name $Network.VNet --address-prefixes $Network.CIDR --subnet-name snet-workload --subnet-prefixes $Network.Subnet -o none
}
az network vnet list --resource-group $RG --query "[].{Name:name,AddressSpace:addressSpace.addressPrefixes[0],Location:location}" -o table
$HubID = az network vnet show -g $RG -n $HubVNet --query id -o tsv
$ProdID = az network vnet show -g $RG -n $ProdVNet --query id -o tsv
$DevID = az network vnet show -g $RG -n $DevVNet --query id -o tsvDo not create manual VNet peerings. AVNM will manage connectivity.
Step 4 — Deploy network security groups
Create one NSG per VNet. Permit inbound TCP 80 from the private lab ranges and deny other inbound traffic.
foreach ($Network in $Networks) {
$NSG = "nsg-$($Network.Role)"
az network nsg create --resource-group $RG --name $NSG --location $Location -o none
az network nsg rule create --resource-group $RG --nsg-name $NSG --name Allow-Lab-HTTP --priority 200 --direction Inbound --access Allow --protocol Tcp --source-address-prefixes "10.0.0.0/16" "10.10.0.0/16" "10.20.0.0/16" --source-port-ranges "*" --destination-address-prefixes "*" --destination-port-ranges 80 -o none
az network nsg rule create --resource-group $RG --nsg-name $NSG --name Deny-Other-Inbound --priority 4000 --direction Inbound --access Deny --protocol "*" --source-address-prefixes "*" --destination-address-prefixes "*" --destination-port-ranges "*" -o none
az network vnet subnet update --resource-group $RG --vnet-name $Network.VNet --name snet-workload --network-security-group $NSG -o none
}
az network nsg rule list --resource-group $RG --nsg-name nsg-prod --query "[].{Name:name,Priority:priority,Access:access,Direction:direction}" -o tableStep 5 — Configure explicit outbound connectivity
Deploy one NAT gateway per VNet for outbound communication required by VM agents and Run Command.
foreach ($Network in $Networks) {
$PublicIP = "pip-nat-$($Network.Role)"
$NAT = "nat-$($Network.Role)"
az network public-ip create --resource-group $RG --location $Location --name $PublicIP --sku Standard --allocation-method Static -o none
az network nat gateway create --resource-group $RG --location $Location --name $NAT --public-ip-addresses $PublicIP --idle-timeout 4 -o none
az network vnet subnet update --resource-group $RG --vnet-name $Network.VNet --name snet-workload --nat-gateway $NAT -o none
}
az network nat gateway list --resource-group $RG -o tableNAT gateways provide outbound connectivity only, not hub transit or inbound VM access.
Step 6 — Deploy the Windows virtual machines
Use a temporary administrator password in memory. Check VM size availability and quota first. Avoid debug logging and shell transcription.
$AdminUser = "labadmin"
$AdminPassword = "Az9!" + [guid]::NewGuid().ToString("N")
$VMSize = "Standard_B2s"
foreach ($Network in $Networks) {
$NIC = "nic-$($Network.Role)"
az network nic create --resource-group $RG --location $Location --name $NIC --vnet-name $Network.VNet --subnet snet-workload --private-ip-address $Network.IP -o none
az vm create --resource-group $RG --location $Location --name $Network.VM --nics $NIC --image Win2022Datacenter --size $VMSize --admin-username $AdminUser --admin-password $AdminPassword --os-disk-sku StandardSSD_LRS -o none
}
Remove-Variable AdminPassword
az vm list --resource-group $RG --show-details --query "[].{Name:name,PowerState:powerState,PrivateIP:privateIps,PublicIP:publicIps}" -o tableExpected: vm-hub at 10.0.1.10, vm-prod at 10.10.1.10, vm-dev at 10.20.1.10, all running, no VM public IP.
Step 7 — Configure the test applications
Use VM Run Command to install IIS on each private Windows VM without exposing RDP. Wait for the VM agent to be ready.
@'
$ErrorActionPreference = "Stop"
Install-WindowsFeature Web-Server | Out-Null
$Page = "AZURE WORKSHOPZ - $env:COMPUTERNAME"
Set-Content -Path "C:\inetpub\wwwroot\index.html" -Value $Page
New-NetFirewallRule -Name "AVNM-Lab-HTTP" -DisplayName "AVNM Lab HTTP" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 80 | Out-Null
Start-Service W3SVC
$Response = Invoke-WebRequest -Uri "http://localhost/index.html" -UseBasicParsing
Write-Output $Response.Content
Write-Output "LAB_SETUP_OK"
'@ | Set-Content "./Install-LabWeb.ps1"function Invoke-LabVM {
param([string]$VM,[string]$ScriptFile)
$Path = (Resolve-Path $ScriptFile).Path
$Result = az vm run-command invoke --resource-group $RG --name $VM --command-id RunPowerShellScript --scripts "@$Path" --query "value[].message" -o tsv
if ($LASTEXITCODE -ne 0) { throw "Run Command failed on $VM" }
$Result -join [Environment]::NewLine
}
foreach ($Network in $Networks) {
$Result = Invoke-LabVM -VM $Network.VM -ScriptFile "./Install-LabWeb.ps1"
$Result
if ($Result -notmatch "LAB_SETUP_OK") { throw "Application setup failed on $($Network.VM)" }
}All three local IIS requests must succeed.
Step 8 — Create a reusable connectivity test
The helper executes a new HTTP request from a source VM to the destination's private IP. VM Run Command itself must succeed; an HTTP failure is not automatically proof of a specific network restriction.
function Test-LabHTTP {
param([string]$SourceVM,[string]$DestinationIP)
$Script = @'
try {
$Response = Invoke-WebRequest -Uri "http://DESTINATION_IP/index.html" -UseBasicParsing -TimeoutSec 8 -ErrorAction Stop
Write-Output "HTTP_OK"
Write-Output $Response.Content
} catch {
Write-Output "HTTP_FAILED"
Write-Output $_.Exception.Message
}
'@
$Script.Replace("DESTINATION_IP",$DestinationIP) | Set-Content "./Test-LabHTTP.ps1"
Invoke-LabVM -VM $SourceVM -ScriptFile "./Test-LabHTTP.ps1"
}
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"
Test-LabHTTP -SourceVM vm-prod -DestinationIP "10.20.1.10"Expected: HTTP_FAILED for all cross-VNet tests. Confirm IIS is healthy locally and the output contains a valid test marker. The VNets are isolated before connectivity deployment.
Step 9 — Deploy Azure Virtual Network Manager
Create the Network Manager with Connectivity and SecurityAdmin capabilities at sandbox subscription scope.
az network manager create --name $AVNM --resource-group $RG --location $Location --scope-accesses Connectivity SecurityAdmin --network-manager-scopes "subscriptions=/subscriptions/$Subscription" --description "Azure Workshopz enterprise network manager"
$AVNMID = az network manager show --resource-group $RG --name $AVNM --query id -o tsv
az network manager show --resource-group $RG --name $AVNM -o jsonAlthough management scope covers the subscription, configurations target the explicitly selected lab network groups.
Step 10 — Create enterprise network groups
Create separate groups for spoke connectivity and production security governance.
az network manager group create --name $SpokeGroup --network-manager-name $AVNM --resource-group $RG --description "Production and development spokes"
az network manager group create --name $ProdGroup --network-manager-name $AVNM --resource-group $RG --description "Production security governance"
az network manager group static-member create --network-manager-name $AVNM --resource-group $RG --network-group-name $SpokeGroup --static-member-name production --resource-id $ProdID
az network manager group static-member create --network-manager-name $AVNM --resource-group $RG --network-group-name $SpokeGroup --static-member-name development --resource-id $DevID
az network manager group static-member create --network-manager-name $AVNM --resource-group $RG --network-group-name $ProdGroup --static-member-name production --resource-id $ProdID
$SpokeGroupID = az network manager group show --network-manager-name $AVNM --resource-group $RG --name $SpokeGroup --query id -o tsv
$ProdGroupID = az network manager group show --network-manager-name $AVNM --resource-group $RG --name $ProdGroup --query id -o tsv
az network manager group static-member list --network-manager-name $AVNM --resource-group $RG --network-group-name $SpokeGroup -o json
az network manager group static-member list --network-manager-name $AVNM --resource-group $RG --network-group-name $ProdGroup -o jsonExpected: ng-spokes contains production and development; ng-production contains only production. Separate connectivity and security groups offer flexible governance.
Step 11 — Create the hub-and-spoke connectivity configuration
Use Azure CLI az rest and PowerShell-generated ARM JSON to avoid inline quoting problems.
$NetworkAPIVersion = "2025-05-01"
$ConnectivityID = "$AVNMID/connectivityConfigurations/$ConnectivityConfig"
function Set-LabConnectivity {
param([ValidateSet("None","DirectlyConnected")][string]$GroupConnectivity)
$Body = @{
properties = @{
description = "Enterprise hub-spoke topology"
connectivityTopology = "HubAndSpoke"
deleteExistingPeering = "False"
isGlobal = "False"
hubs = @(
@{resourceId=$HubID; resourceType="Microsoft.Network/virtualNetworks"}
)
appliesToGroups = @(
@{networkGroupId=$SpokeGroupID; groupConnectivity=$GroupConnectivity; useHubGateway="False"; isGlobal="False"}
)
}
}
$Body | ConvertTo-Json -Depth 15 | Set-Content "./connectivity.json"
$URI = "https://management.azure.com" + $ConnectivityID + "?api-version=$NetworkAPIVersion"
az rest --method put --uri $URI --body "@connectivity.json"
}
Set-LabConnectivity -GroupConnectivity None
az network manager connect-config show --network-manager-name $AVNM --resource-group $RG --configuration-name $ConnectivityConfig -o jsonThe desired configuration exists but is not deployed.
Step 12 — Deploy centralized connectivity
function Publish-LabConfiguration {
param(
[ValidateSet("Connectivity","SecurityAdmin")][string]$Type,
[string]$ConfigurationID
)
az network manager post-commit --network-manager-name $AVNM --resource-group $RG --commit-type $Type --configuration-ids $ConfigurationID --target-locations $Location
if ($LASTEXITCODE -ne 0) { throw "Configuration commit failed." }
}
function Get-LabDeploymentStatus {
az network manager list-deploy-status --network-manager-name $AVNM --resource-group $RG --deployment-types Connectivity SecurityAdmin --regions $Location -o json
}
Publish-LabConfiguration -Type Connectivity -ConfigurationID $ConnectivityID
Get-LabDeploymentStatusRepeat deployment inspection until connectivity succeeds and the applied configuration converges. A successful submission is not proof of completed data-plane convergence.
az network vnet peering list --resource-group $RG --vnet-name $ProdVNet --query "[].{Name:name,State:peeringState,Remote:remoteVirtualNetwork.id}" -o table
az network manager list-effective-connectivity-config --resource-group $RG --virtual-network-name $ProdVNet -o jsonStep 13 — Verify centralized connectivity
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"
Test-LabHTTP -SourceVM vm-prod -DestinationIP "10.20.1.10"Expected: Hub to Production HTTP_OK; Hub to Development HTTP_OK; Production to Development HTTP_FAILED. VNet peering is not inherently transitive. There is no forwarding router or firewall in this topology. Do not continue until hub-to-spoke connectivity works.
Step 14 — BREAK #1: Missing network group membership
Simulate an administrator removing the development network from the connectivity group.
az network manager group static-member delete --network-manager-name $AVNM --resource-group $RG --network-group-name $SpokeGroup --static-member-name development --yesAllow membership changes to propagate. Active configurations are automatically applied according to membership; a separate configuration commit is not normally required.
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"
az network manager group static-member list --network-manager-name $AVNM --resource-group $RG --network-group-name $SpokeGroup -o json
az network manager list-effective-connectivity-config --resource-group $RG --virtual-network-name $DevVNet -o jsonExpected after convergence: HTTP_FAILED. Diagnose missing membership, then restore it.
az network manager group static-member create --network-manager-name $AVNM --resource-group $RG --network-group-name $SpokeGroup --static-member-name development --resource-id $DevIDAfter convergence:
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"Expected HTTP_OK. Incorrect network membership can break centralized connectivity even when the VNet and VM are healthy.
Step 15 — Enable direct spoke-to-spoke connectivity
Set-LabConnectivity -GroupConnectivity DirectlyConnected
Publish-LabConfiguration -Type Connectivity -ConfigurationID $ConnectivityID
Get-LabDeploymentStatusWait for successful deployment and convergence.
Test-LabHTTP -SourceVM vm-prod -DestinationIP "10.20.1.10"
Test-LabHTTP -SourceVM vm-dev -DestinationIP "10.10.1.10"
az network nic show-effective-route-table --resource-group $RG --name nic-prod -o tableExpected HTTP_OK both ways. AVNM uses connected groups; do not assume each relationship appears as a traditional individual VNet peering.
Step 16 — BREAK #2: Undeployed connectivity changes
Save a change disabling direct spoke communication, without deploying it.
Set-LabConnectivity -GroupConnectivity None
az network manager connect-config show --network-manager-name $AVNM --resource-group $RG --configuration-name $ConnectivityConfig -o json
Test-LabHTTP -SourceVM vm-prod -DestinationIP "10.20.1.10"
az network manager list-effective-connectivity-config --resource-group $RG --virtual-network-name $ProdVNet -o jsonExpected HTTP_OK: saved desired state differs from deployed state.
Publish-LabConfiguration -Type Connectivity -ConfigurationID $ConnectivityID
Get-LabDeploymentStatusAfter convergence:
Test-LabHTTP -SourceVM vm-prod -DestinationIP "10.20.1.10"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"Expected spoke-to-spoke HTTP_FAILED, hub-to-spoke HTTP_OK. Creating or updating a configuration is not deploying it.
Step 17 — Create centralized security administration
Create a security configuration and a rule collection targeting only the production network group.
az network manager security-admin-config create --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --description "Enterprise network security governance"
az network manager security-admin-config rule-collection create --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --rule-collection-name $RuleCollection --applies-to-groups "network-group-id=$ProdGroupID"
$SecurityID = az network manager security-admin-config show --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --query id -o tsv
az network manager security-admin-config rule-collection rule create --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --rule-collection-name $RuleCollection --rule-name $AdminRule --kind Custom --protocol Tcp --access Deny --priority 100 --direction Inbound --sources "address-prefix=10.0.0.0/16" "address-prefix-type=IPPrefix" --destinations "address-prefix=10.10.0.0/16" "address-prefix-type=IPPrefix" --source-port-ranges "*" --dest-port-ranges 80The rule targets inbound HTTP from the hub to production. Development is outside the security group.
Step 18 — BREAK #3: Centralized Deny overrides the NSG
Publish-LabConfiguration -Type SecurityAdmin -ConfigurationID $SecurityID
Get-LabDeploymentStatusAfter deployment convergence:
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"
az network nsg rule show --resource-group $RG --nsg-name nsg-prod --name Allow-Lab-HTTP -o json
az network manager list-effective-security-admin-rule --resource-group $RG --virtual-network-name $ProdVNet -o jsonExpected production HTTP_FAILED and development HTTP_OK. The local production NSG allows HTTP, but the security admin Deny is evaluated first. A local NSG cannot override the centralized Deny.
Step 19 — Repair the centralized security rule
function Set-LabAdminAction {
param([ValidateSet("Allow","Deny","AlwaysAllow")][string]$Action)
az network manager security-admin-config rule-collection rule update --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --rule-collection-name $RuleCollection --rule-name $AdminRule --access $Action
}
Set-LabAdminAction -Action Allow
Publish-LabConfiguration -Type SecurityAdmin -ConfigurationID $SecurityID
Get-LabDeploymentStatusAfter convergence:
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"Expected HTTP_OK. Centralized Allow passes matching traffic to the NSG, which also permits it.
Step 20 — BREAK #4: Local NSG overrides centralized Allow
Simulate a higher-priority local NSG restriction.
az network nsg rule create --resource-group $RG --nsg-name nsg-prod --name Deny-Hub-HTTP --priority 100 --direction Inbound --access Deny --protocol Tcp --source-address-prefixes "10.0.0.0/16" --source-port-ranges "*" --destination-address-prefixes "*" --destination-port-ranges 80Allow the NSG change to propagate and initiate a fresh HTTP connection.
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"
az network nic list-effective-nsg --resource-group $RG --name nic-prod -o json
az network manager list-effective-security-admin-rule --resource-group $RG --virtual-network-name $ProdVNet -o jsonExpected HTTP_FAILED. Centralized Allow does not bypass local NSG evaluation. Leave the local Deny in place for the next experiment.
Step 21 — BREAK #5: Demonstrate AlwaysAllow precedence
Set-LabAdminAction -Action AlwaysAllow
Publish-LabConfiguration -Type SecurityAdmin -ConfigurationID $SecurityID
Get-LabDeploymentStatusAfter convergence:
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"
az network nsg rule show --resource-group $RG --nsg-name nsg-prod --name Deny-Hub-HTTP -o jsonExpected HTTP_OK, despite the local Deny. AlwaysAllow bypasses NSG evaluation for matching traffic.
Security comparison: Deny + NSG Allow = blocked. Allow + NSG Allow = permitted. Allow + NSG Deny = blocked. AlwaysAllow + NSG Deny = permitted at the Azure network layer.
Use narrowly scoped AlwaysAllow rules only for justified requirements. Broad rules can undermine workload segmentation.
Step 22 — BREAK #6: Guest firewall blocks centrally allowed traffic
AVNM cannot bypass a guest OS firewall. Simulate a Windows Firewall restriction.
@'
New-NetFirewallRule -Name "AVNM-Lab-Incident" -DisplayName "AVNM Lab Incident" -Direction Inbound -Action Block -Protocol TCP -LocalPort 80 -RemoteAddress "10.0.0.0/16" | Out-Null
Write-Output "GUEST_BLOCK_CREATED"
'@ | Set-Content "./Break-GuestFirewall.ps1"
Invoke-LabVM -VM vm-prod -ScriptFile "./Break-GuestFirewall.ps1"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"Expected HTTP_FAILED. Diagnose the guest firewall and application locally.
@'
Get-NetFirewallRule -Name "AVNM-Lab-Incident"
Get-Service W3SVC
Get-NetTCPConnection -LocalPort 80 -State Listen
Invoke-WebRequest -Uri "http://localhost/index.html" -UseBasicParsing | Select-Object StatusCode
'@ | Set-Content "./Diagnose-GuestFirewall.ps1"
Invoke-LabVM -VM vm-prod -ScriptFile "./Diagnose-GuestFirewall.ps1"IIS should still be running, listening and locally accessible. Remove the injected block.
@'
Remove-NetFirewallRule -Name "AVNM-Lab-Incident"
Write-Output "GUEST_FIREWALL_REPAIRED"
'@ | Set-Content "./Repair-GuestFirewall.ps1"
Invoke-LabVM -VM vm-prod -ScriptFile "./Repair-GuestFirewall.ps1"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"Expected HTTP_OK. Application availability also depends on guest firewall, listening port and service health.
Step 23 — BREAK #7: Incorrect security group membership
Remove the local production Deny, then expand the centralized Deny destination scope while targeting only production.
az network nsg rule delete --resource-group $RG --nsg-name nsg-prod --name Deny-Hub-HTTP
az network manager security-admin-config rule-collection rule update --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --rule-collection-name $RuleCollection --rule-name $AdminRule --access Deny --destinations "address-prefix=*" "address-prefix-type=IPPrefix"
Publish-LabConfiguration -Type SecurityAdmin -ConfigurationID $SecurityID
Get-LabDeploymentStatusAfter convergence, confirm production is blocked and development is accessible.
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.10.1.10"
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"Simulate accidentally including development in the production security group.
az network manager group static-member create --network-manager-name $AVNM --resource-group $RG --network-group-name $ProdGroup --static-member-name development --resource-id $DevIDAfter convergence:
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"
az network manager list-effective-security-admin-rule --resource-group $RG --virtual-network-name $DevVNet -o json
az network manager group static-member list --network-manager-name $AVNM --resource-group $RG --network-group-name $ProdGroup -o jsonExpected HTTP_FAILED. Investigate the newly effective Deny and incorrect membership. Remove the development member.
az network manager group static-member delete --network-manager-name $AVNM --resource-group $RG --network-group-name $ProdGroup --static-member-name development --yesAfter convergence:
Test-LabHTTP -SourceVM vm-hub -DestinationIP "10.20.1.10"Expected HTTP_OK. Restore the original narrowly scoped production Allow.
az network manager security-admin-config rule-collection rule update --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --rule-collection-name $RuleCollection --rule-name $AdminRule --access Allow --destinations "address-prefix=10.10.0.0/16" "address-prefix-type=IPPrefix"
Publish-LabConfiguration -Type SecurityAdmin -ConfigurationID $SecurityID
Get-LabDeploymentStatusWait for convergence. Governance depends on accurate targeting, membership and traffic conditions.
Step 24 — Enterprise troubleshooting and configuration analysis
Export deployment state, effective configuration, security admin rules, routes, NSGs and management-plane changes.
$ReportDir = Join-Path $LabDir "reports"
New-Item -ItemType Directory -Path $ReportDir -Force | Out-Null
Get-LabDeploymentStatus | Set-Content "$ReportDir/deployment-status.json"
foreach ($Network in $Networks) {
$Name = $Network.Role
az network manager list-effective-connectivity-config --resource-group $RG --virtual-network-name $Network.VNet -o json | Set-Content "$ReportDir/$Name-connectivity.json"
az network manager list-effective-security-admin-rule --resource-group $RG --virtual-network-name $Network.VNet -o json | Set-Content "$ReportDir/$Name-security-admin.json"
az network nic show-effective-route-table --resource-group $RG --name "nic-$Name" -o json | Set-Content "$ReportDir/$Name-routes.json"
az network nic list-effective-nsg --resource-group $RG --name "nic-$Name" -o json | Set-Content "$ReportDir/$Name-nsg.json"
}
az monitor activity-log list --resource-group $RG --offset 24h -o json | Set-Content "$ReportDir/activity-log.json"
az monitor activity-log list --resource-group $RG --offset 24h --query "[].{Time:eventTimestamp,Operation:operationName.localizedValue,Status:status.localizedValue,Caller:caller}" -o tableActivity Logs document management-plane changes, not individual network flows.
Step 25 — Perform final connectivity verification
Verify the intended final configuration: hub-to-spoke connectivity, no direct spoke-to-spoke connectivity, narrow centralized Allow and no injected NSG or guest firewall Deny.
$Tests = @(
@{Source="vm-hub"; Destination="10.10.1.10"; Expected="HTTP_OK"},
@{Source="vm-hub"; Destination="10.20.1.10"; Expected="HTTP_OK"},
@{Source="vm-prod"; Destination="10.0.1.10"; Expected="HTTP_OK"},
@{Source="vm-dev"; Destination="10.0.1.10"; Expected="HTTP_OK"},
@{Source="vm-prod"; Destination="10.20.1.10"; Expected="HTTP_FAILED"},
@{Source="vm-dev"; Destination="10.10.1.10"; Expected="HTTP_FAILED"}
)
$Results = foreach ($Test in $Tests) {
$Output = Test-LabHTTP -SourceVM $Test.Source -DestinationIP $Test.Destination
$Observed = if ($Output -match "HTTP_OK") {
"HTTP_OK"
} elseif ($Output -match "HTTP_FAILED") {
"HTTP_FAILED"
} else {
"TEST_ERROR"
}
[PSCustomObject]@{
Source = $Test.Source
Destination = $Test.Destination
Expected = $Test.Expected
Observed = $Observed
Passed = $Observed -eq $Test.Expected
Details = $Output
}
}
$Results | Format-Table Source,Destination,Expected,Observed,Passed
$Results | Export-Csv "$ReportDir/final-validation.csv" -NoTypeInformation
if ($Results.Passed -contains $false) { throw "One or more connectivity tests failed." }
Write-Host "All connectivity tests passed." -ForegroundColor GreenExpected: both hub-to-spoke directions allowed; both spoke-to-spoke directions blocked. Investigate any TEST_ERROR and independently confirm healthy local IIS.
Step 26 — Archive the workshop evidence
$Evidence = Join-Path $HOME "avnm-megalab-$Suffix-evidence.zip"
Compress-Archive -Path "$ReportDir/*" -DestinationPath $Evidence -Force
Get-Item $EvidenceRetain the evidence for incident documentation. Review management metadata before sharing externally.
Step 27 — Clean up Azure Virtual Network Manager
Before deleting AVNM, remove its applied security and connectivity configurations by committing an empty list for each type in the target region. Ensure this is the dedicated workshop network manager only.
foreach ($Type in @("SecurityAdmin","Connectivity")) {
$Body = @{
commitType = $Type
configurationIds = @()
targetLocations = @($Location)
}
$Body | ConvertTo-Json -Depth 5 | Set-Content "./remove-$Type.json"
$URI = "https://management.azure.com" + $AVNMID + "/commit?api-version=$NetworkAPIVersion"
az rest --method post --uri $URI --body "@remove-$Type.json"
}
Get-LabDeploymentStatusWait for removal deployments to complete. Verify the workshop configurations are no longer applied.
foreach ($Network in $Networks) {
az network manager list-effective-connectivity-config --resource-group $RG --virtual-network-name $Network.VNet -o json
az network manager list-effective-security-admin-rule --resource-group $RG --virtual-network-name $Network.VNet -o json
}Delete the configuration resources only after successful removal.
az network manager connect-config delete --configuration-name $ConnectivityConfig --network-manager-name $AVNM --resource-group $RG --yes
az network manager security-admin-config delete --configuration-name $SecurityConfig --network-manager-name $AVNM --resource-group $RG --yes
az resource list --resource-group $RG -o tableConfirm the resource group contains only disposable lab resources.
az group delete --subscription $Subscription --name $RG --yes
az group exists --subscription $Subscription --name $RGExpected: false. Keep the locally collected evidence.
Enterprise troubleshooting matrix
1. Missing network membership: hub cannot reach spoke; inspect and restore the static member.
2. Undeployed configuration: desired state changes have no effect; inspect effective state and commit.
3. Centralized Deny: NSG allows but traffic fails; inspect and correct security admin rule.
4. Local NSG Deny: centralized Allow but traffic fails; repair the higher-priority local rule.
5. AlwaysAllow precedence: traffic succeeds despite local Deny; review centralized rule scope.
6. Guest firewall restriction: Azure permits but application fails; investigate and repair Windows Firewall.
7. Incorrect security membership: unintended environment blocked; correct group targeting and restore the narrow rule.
Recommended enterprise troubleshooting workflow
APPLICATION CONNECTIVITY FAILURE
|
CHECK APPLICATION AND LISTENING PORT
|
CHECK GUEST OPERATING SYSTEM FIREWALL
|
CHECK EFFECTIVE SECURITY ADMIN RULES
|
CHECK EFFECTIVE NSG CONFIGURATION
|
CHECK EFFECTIVE ROUTES
|
CHECK NETWORK GROUP MEMBERSHIP
|
CHECK CONFIGURATION DEPLOYMENT STATUS
|
INVESTIGATE ACTIVITY LOGS
|
REPAIR AND VERIFYAdapt the order to the symptoms and recent configuration changes.
Production architecture improvements
Management group-level scope; multi-subscription onboarding; Azure Policy-based dynamic membership; environment-specific network groups; centralized security baselines; governance exception groups; Azure Firewall and Virtual WAN integration; centralized routing; AVNM Network Verifier; infrastructure as code; configuration compliance reports; change approval and deployment pipelines.
Advanced engineering challenges
Challenge 1 — Dynamic network groups
Replace static membership with Azure Policy-based dynamic membership. Classify networks using Environment=Production and Environment=Development tags and investigate how changes affect membership and enforcement.
Challenge 2 — Multi-subscription governance
Create central networking and dedicated workload subscriptions. Extend the Network Manager scope across them and manage connectivity and security centrally.
Challenge 3 — Enterprise security baseline
Block unnecessary inbound management ports centrally and implement a narrowly scoped exception for an authorized management subnet. Investigate rule priority and exception handling.
Challenge 4 — Global network connectivity
Deploy a VNet in North Europe, extend the architecture with regional or global connectivity and investigate cross-region communication.
Challenge 5 — Automated configuration drift reporting
Build a PowerShell script comparing expected and actual network membership, saved and effective connectivity, effective security admin rules and deployment status. Generate a compliance report.
Challenge 6 — Network Verifier
Explore Network Verifier in a separate supported configuration. Compare modeled reachability with real HTTP tests.
Knowledge assessment
1. What is the purpose of Azure Virtual Network Manager?
2. What is the difference between a management scope and a network group?
3. How does static membership differ from dynamic membership?
4. Why must configurations be committed?
5. Is VNet peering transitive?
6. How does direct spoke connectivity work?
7. What is the difference between Allow and AlwaysAllow?
8. Can an NSG override a security admin Deny?
9. Can AlwaysAllow bypass Windows Firewall?
10. How can incorrect membership affect production connectivity?
11. How can you investigate effective configurations?
12. Why remove applied configurations before deleting AVNM?
Conclusion
Managing enterprise Azure networking is not simply about creating VNets, configuring peerings and assigning NSGs. At scale, organizations require centralized management, consistent security enforcement, controlled connectivity, operational visibility and reliable recovery.
This mega lab designs an integrated AVNM environment using Azure CLI and PowerShell, with centralized hub-and-spoke connectivity and seven troubleshooting scenarios demonstrating network security layers.
Centralized network governance reduces configuration complexity, but effective troubleshooting still requires understanding every layer of the network and application architecture.
DEPLOY → CONNECT → GOVERN → BREAK → DIAGNOSE → REPAIR → VERIFY
Official Microsoft documentation
https://learn.microsoft.com/en-us/azure/virtual-network-manager/overview
https://learn.microsoft.com/en-us/cli/azure/network/manager
https://learn.microsoft.com/en-us/cli/azure/network/manager/connect-config
https://learn.microsoft.com/en-us/azure/virtual-network-manager/create-virtual-network-manager-cli
https://learn.microsoft.com/en-us/azure/virtual-network-manager/how-to-create-network-manager-topologies
https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-security-admins
https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-enforcement
https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-deployments
https://learn.microsoft.com/en-us/azure/virtual-network-manager/common-issues
https://learn.microsoft.com/en-us/azure/virtual-network-manager/concept-remove-components-checklist
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command
https://azure.microsoft.com/en-us/pricing/details/virtual-network-manager/
Azure Workshopz | Beyond Cloud with Chriz
https://www.beyondcloudwithchriz.com/azureworkshopz
Hands-on Microsoft Azure infrastructure workshops for cloud engineers, architects and IT professionals.
LEARN. BUILD. BREAK. RECOVER.
Technical validation: This workshop is based on documented Azure CLI, PowerShell and Azure REST API behavior. It has not been executed end-to-end in a live Azure subscription. Expected connectivity results require live validation.
Comments