
Azure Workshopz | Beyond Cloud with Chriz
DEPLOY • SECURE • ROUTE • BREAK • DIAGNOSE • REPAIR • VERIFY • CLEAN UP
Level: Intermediate to AdvancedPlatform: Microsoft AzureTools: Azure CLI and Azure Cloud Shell (Bash)Deployment: Azure CLI only, including az rest for Firewall Policy rule managementTechnologies: Azure Firewall Standard, Firewall Policy, Virtual Networks, VNet Peering, UDRs, DNS Proxy, Azure Monitor, Log Analytics, NSGsEstimated cost level: High
Introduction
Your Azure virtual machines are running successfully.
Both virtual networks are connected to a central hub, your routing tables look correct, and the application is responding.
But what happens when an administrator introduces an incorrect firewall rule?
What if traffic is routed correctly but the firewall denies the connection?
What if the firewall allows HTTPS, but DNS resolution suddenly stops working?
And how can you determine whether a failed connection is caused by Azure routing, Network Security Groups, DNS, or Firewall Policy?
In this workshop, we will build a complete Azure Firewall environment from scratch.
We will deploy a traditional hub-and-spoke architecture with a centralized Azure Firewall Standard instance, a Firewall Policy, two Linux virtual machines, DNS proxy, and route tables that force traffic through the firewall.
Once connectivity is established, we will deliberately introduce several network failures.
Instead of guessing which configuration is responsible, we will investigate the data plane, inspect effective routes, query firewall logs using KQL, identify the root cause, and implement targeted repairs.
Everything will be deployed and managed through Azure CLI.
The goal is to understand how Azure Firewall behaves during real network security incidents — not simply how to deploy it.
What You'll Learn
By the end of this workshop, you will be able to:
Deploy a traditional Azure hub-and-spoke network.
Configure bidirectional VNet peering with forwarded traffic.
Deploy Azure Firewall Standard.
Create a centralized Azure Firewall Policy.
Configure network and application rule collections.
Implement stateful spoke-to-spoke traffic filtering.
Configure Azure Firewall DNS proxy.
Force traffic through Azure Firewall using User Defined Routes.
Verify effective routing from Azure virtual machines.
Deploy private Linux test workloads.
Configure structured Firewall diagnostic logs.
Query firewall activity using Kusto Query Language (KQL).
Simulate network rule failures.
Simulate application rule failures.
Simulate DNS proxy failures.
Introduce and repair an incorrect UDR.
Validate recovery and clean up all resources.
Workshop Architecture
We will deploy one hub VNet containing Azure Firewall and two spoke VNets containing private Linux virtual machines.
AZURE CLOUD SHELL
|
Azure CLI
|
v
+-----------------------+
| AZURE HUB VNET |
| 10.0.0.0/16 |
| |
| AzureFirewallSubnet |
| 10.0.0.0/26 |
| |
| +---------------+ |
| | AZURE FIREWALL| |
| | STANDARD | |
| | | |
| | Firewall | |
| | Policy | |
| | | |
| | Network Rules | |
| | App Rules | |
| | DNS Proxy | |
| +-------+-------+ |
+-----------+-----------+
|
+-------------+-------------+
| |
| VNet Peering | VNet Peering
| |
v v
+----------------------+ +----------------------+
| SPOKE A | | SPOKE B |
| CLIENT VNET | | SERVER VNET |
| | | |
| 10.10.0.0/16 | | 10.20.0.0/16 |
| | | |
| snet-client | | snet-server |
| 10.10.1.0/24 | | 10.20.1.0/24 |
| | | |
| Ubuntu VM-A | | Ubuntu VM-B |
| Private IP only | | Private IP only |
| | | |
| UDR -> Firewall | | UDR -> Firewall |
+----------------------+ +----------------------+
AZURE MONITOR
|
Log Analytics
|
+------------+------------+
| | |
Network App Rule DNS
Logs Logs LogsTraffic flow
The normal packet path between the two spokes will be:
VM-A
|
v
Spoke A Route Table
|
| Next hop = Azure Firewall
v
Azure Firewall Private IP
|
v
Firewall Policy Evaluation
|
| Network Rule: Allow TCP/22
v
Hub-to-Spoke B Peering
|
v
VM-B
|
| Stateful return traffic
v
VM-AFor internet access, Azure Firewall evaluates application rules and uses its public IP address for outbound connectivity.
For DNS, the spoke virtual machines send their queries to Azure Firewall's DNS proxy.
IP Addressing Plan
Component | Address space |
Hub VNet | 10.0.0.0/16 |
AzureFirewallSubnet | 10.0.0.0/26 |
Spoke A VNet | 10.10.0.0/16 |
Spoke A subnet | 10.10.1.0/24 |
Spoke B VNet | 10.20.0.0/16 |
Spoke B subnet | 10.20.1.0/24 |
Azure Firewall private IP | Assigned dynamically |
Client VM private IP | Assigned dynamically |
Server VM private IP | Assigned dynamically |
No public IP addresses will be assigned to the workload VMs.
This avoids exposing administrative services directly to the internet.
Azure Run Command will be used for guest-level troubleshooting.
Prerequisites and Costs
Requirements
You need:
An Azure subscription with permission to create networking, compute, and monitoring resources.
Azure Cloud Shell using Bash.
Azure CLI with the azure-firewall extension.
Sufficient regional quota for two small Linux VMs.
Permission to create Azure Firewall Standard.
Permission to create diagnostic settings and Log Analytics workspaces.
A region that supports the selected resources.
The workshop uses jq to prepare Firewall Policy JSON payloads.
Check the required tools:
az version
jq --versionCost warning
Azure Firewall Standard is considerably more expensive than a typical two-VM networking lab.
Billable components include:
Azure Firewall deployment and processing.
Azure Firewall public IP.
Two Linux VMs.
Managed disks.
Log Analytics ingestion and retention.
Applicable outbound and cross-network data transfer.
Azure Firewall remains billable even when your workload VMs are stopped.
Use a dedicated resource group and delete the environment immediately after finishing the workshop.
Pricing:
Lab 1 — Prepare Azure Cloud Shell
Step 1 — Select the subscription
az account show \
--query "{Name:name,SubscriptionId:id}" \
--output tableIf necessary:
az account set \
--subscription "<YOUR-SUBSCRIPTION-ID>"Step 2 — Install the Azure Firewall extension
az extension add \
--name azure-firewall \
--upgradeVerify:
az extension show \
--name azure-firewall \
--query "{Name:name,Version:version}" \
--output tableStep 3 — Configure environment variables
Run these commands in one Cloud Shell Bash session.
# General
export LOCATION="westeurope"
export SUFFIX=$(openssl rand -hex 3)
export RG="rg-fw-deepdive-$SUFFIX"
# Networking
export HUB_VNET="vnet-hub-$SUFFIX"
export VNET_A="vnet-client-$SUFFIX"
export VNET_B="vnet-server-$SUFFIX"
export HUB_CIDR="10.0.0.0/16"
export SPOKE_A_CIDR="10.10.0.0/16"
export SPOKE_B_CIDR="10.20.0.0/16"
export SUBNET_A="snet-client"
export SUBNET_B="snet-server"
# Azure Firewall
export FW="fw-deepdive-$SUFFIX"
export FW_PIP="pip-firewall-$SUFFIX"
export POLICY="policy-deepdive-$SUFFIX"
export RCG="rcg-deepdive"
# Route tables
export RT_A="rt-client-$SUFFIX"
export RT_B="rt-server-$SUFFIX"
# Network Security Groups
export NSG_A="nsg-client-$SUFFIX"
export NSG_B="nsg-server-$SUFFIX"
# Virtual machines
export VM_A="vm-client-$SUFFIX"
export VM_B="vm-server-$SUFFIX"
# Monitoring
export LAW="law-fw-deepdive-$SUFFIX"
export DIAG="diag-firewall"Verify:
echo "Resource Group: $RG"
echo "Location: $LOCATION"
echo "Firewall: $FW"
echo "Policy: $POLICY"Step 4 — Create the resource group
az group create \
--name "$RG" \
--location "$LOCATION" \
--tags Environment=Workshop \
Project=Azure-Firewall-DeepDiveExpected result: Resource group provisioning succeeds.
Lab 2 — Deploy the Hub Virtual Network
The hub contains Azure Firewall.
Azure Firewall requires a dedicated subnet named exactly AzureFirewallSubnet.
Step 1 — Create the hub VNet
az network vnet create \
--resource-group "$RG" \
--name "$HUB_VNET" \
--location "$LOCATION" \
--address-prefixes "$HUB_CIDR" \
--subnet-name AzureFirewallSubnet \
--subnet-prefixes 10.0.0.0/26A /26 subnet is the minimum recommended size for Azure Firewall.
Do not deploy virtual machines or other application workloads into AzureFirewallSubnet.
Step 2 — Verify the subnet
az network vnet subnet show \
--resource-group "$RG" \
--vnet-name "$HUB_VNET" \
--name AzureFirewallSubnet \
--query "{Name:name,AddressPrefix:addressPrefix}" \
--output tableExpected address prefix:
10.0.0.0/26Lab 3 — Deploy the Spoke VNets
Step 1 — Create Spoke A
az network vnet create \
--resource-group "$RG" \
--name "$VNET_A" \
--location "$LOCATION" \
--address-prefixes "$SPOKE_A_CIDR" \
--subnet-name "$SUBNET_A" \
--subnet-prefixes 10.10.1.0/24Step 2 — Create Spoke B
az network vnet create \
--resource-group "$RG" \
--name "$VNET_B" \
--location "$LOCATION" \
--address-prefixes "$SPOKE_B_CIDR" \
--subnet-name "$SUBNET_B" \
--subnet-prefixes 10.20.1.0/24Step 3 — Verify both networks
az network vnet list \
--resource-group "$RG" \
--query "[].{Name:name,AddressSpace:addressSpace.addressPrefixes}" \
--output tableYou should see three VNets: the hub and both spokes.
Lab 4 — Configure Hub-and-Spoke Peering
Virtual Network peering is not transitive.
Peering Spoke A with the hub and Spoke B with the hub does not automatically allow Spoke A to reach Spoke B.
The firewall will provide the forwarding path between the spokes.
We must permit forwarded traffic in both directions of each hub-spoke peering.
Step 1 — Retrieve VNet resource IDs
export HUB_ID=$(az network vnet show \
-g "$RG" -n "$HUB_VNET" \
--query id -o tsv)
export VNET_A_ID=$(az network vnet show \
-g "$RG" -n "$VNET_A" \
--query id -o tsv)
export VNET_B_ID=$(az network vnet show \
-g "$RG" -n "$VNET_B" \
--query id -o tsv)Step 2 — Hub to Spoke A
az network vnet peering create \
--resource-group "$RG" \
--vnet-name "$HUB_VNET" \
--name hub-to-client \
--remote-vnet "$VNET_A_ID" \
--allow-vnet-access true \
--allow-forwarded-traffic trueStep 3 — Spoke A to Hub
az network vnet peering create \
--resource-group "$RG" \
--vnet-name "$VNET_A" \
--name client-to-hub \
--remote-vnet "$HUB_ID" \
--allow-vnet-access true \
--allow-forwarded-traffic trueStep 4 — Hub to Spoke B
az network vnet peering create \
--resource-group "$RG" \
--vnet-name "$HUB_VNET" \
--name hub-to-server \
--remote-vnet "$VNET_B_ID" \
--allow-vnet-access true \
--allow-forwarded-traffic trueStep 5 — Spoke B to Hub
az network vnet peering create \
--resource-group "$RG" \
--vnet-name "$VNET_B" \
--name server-to-hub \
--remote-vnet "$HUB_ID" \
--allow-vnet-access true \
--allow-forwarded-traffic trueStep 6 — Verify peering
az network vnet peering list \
--resource-group "$RG" \
--vnet-name "$HUB_VNET" \
--query "[].{Name:name,State:peeringState,Forwarded:allowForwardedTraffic}" \
--output tableExpected state:
ConnectedImportant: Do not create direct peering between Spoke A and Spoke B.
We want their communication to traverse Azure Firewall.
Lab 5 — Create Azure Firewall Policy
Before deploying the firewall, we'll create its central policy.
A Firewall Policy contains configuration such as DNS settings, rule collection groups, rule collections, and filtering rules.
The policy is separate from the firewall resource, allowing it to be managed and reused.
Step 1 — Create the policy
az network firewall policy create \
--resource-group "$RG" \
--name "$POLICY" \
--location "$LOCATION" \
--sku Standard \
--enable-dns-proxy true \
--threat-intel-mode AlertThis enables DNS proxy and configures threat intelligence in alert mode.
It is not enabling TLS decryption or Premium intrusion detection.
Step 2 — Verify policy settings
az network firewall policy show \
--resource-group "$RG" \
--name "$POLICY" \
--query "{
Name:name,
SKU:sku.tier,
DNS:properties.dnsSettings,
ThreatIntel:properties.threatIntelMode
}" \
--output jsonStep 3 — Retrieve the policy ID
export POLICY_ID=$(az network firewall policy show \
--resource-group "$RG" \
--name "$POLICY" \
--query id \
--output tsv)Lab 6 — Deploy Azure Firewall Standard
Step 1 — Create a public IP
az network public-ip create \
--resource-group "$RG" \
--name "$FW_PIP" \
--location "$LOCATION" \
--sku Standard \
--allocation-method StaticAzure Firewall will use this public IP for permitted outbound internet traffic.
Step 2 — Create the firewall
az network firewall create \
--resource-group "$RG" \
--name "$FW" \
--location "$LOCATION" \
--sku AZFW_VNet \
--tier Standard \
--vnet-name "$HUB_VNET" \
--public-ip "$FW_PIP" \
--conf-name fw-ip-config \
--firewall-policy "$POLICY_ID"The deployment can take a substantial amount of time.
Continue only when Azure reports successful provisioning.
Step 3 — Verify deployment
az network firewall show \
--resource-group "$RG" \
--name "$FW" \
--query "{
Name:name,
State:provisioningState,
Tier:sku.tier
}" \
--output tableExpected provisioning state:
SucceededStep 4 — Retrieve the firewall private IP
export FW_PRIVATE_IP=$(az network firewall show \
--resource-group "$RG" \
--name "$FW" \
--query "ipConfigurations[0].privateIPAddress" \
--output tsv)
echo "Firewall private IP: $FW_PRIVATE_IP"Record this address.
It will be used as:
The next hop for User Defined Routes.
The DNS server address for the spokes.
Step 5 — Retrieve the firewall resource ID
export FW_ID=$(az network firewall show \
--resource-group "$RG" \
--name "$FW" \
--query id \
--output tsv)Checkpoint: Do not continue if the firewall's private IP is missing or its provisioning state is not successful.
Lab 7 — Configure Firewall Rules
Now we will create our initial security policy.
The intended rules are:
Priority | Rule collection | Action | Traffic |
200 | Allow-Spoke-TCP | Allow | Client to server TCP/22 |
300 | Allow-Approved-HTTPS | Allow | Client to www.microsoft.com HTTPS |
Default | Implicit deny | Deny | Everything else not otherwise permitted |
Azure Firewall evaluates DNAT, network, and application rule types according to its documented processing order.
Within our rule collection group, we will define the relevant priorities explicitly.
Step 1 — Create the rule collection group payload
We'll use az rest to apply one JSON representation of the policy rules.
This is still Azure CLI-only deployment.
cat > firewall-rules.json <<EOF
{
"properties": {
"priority": 100,
"ruleCollections": [
{
"name": "Allow-Spoke-TCP",
"priority": 200,
"ruleCollectionType": "FirewallPolicyFilterRuleCollection",
"action": {
"type": "Allow"
},
"rules": [
{
"name": "Allow-Client-to-Server-SSH",
"ruleType": "NetworkRule",
"ipProtocols": [
"TCP"
],
"sourceAddresses": [
"10.10.1.0/24"
],
"destinationAddresses": [
"10.20.1.0/24"
],
"destinationPorts": [
"22"
]
}
]
},
{
"name": "Allow-Approved-HTTPS",
"priority": 300,
"ruleCollectionType": "FirewallPolicyFilterRuleCollection",
"action": {
"type": "Allow"
},
"rules": [
{
"name": "Allow-Microsoft-HTTPS",
"ruleType": "ApplicationRule",
"sourceAddresses": [
"10.10.1.0/24"
],
"protocols": [
{
"protocolType": "Https",
"port": 443
}
],
"targetFqdns": [
"www.microsoft.com"
]
}
]
}
]
}
}
EOFStep 2 — Prepare the REST endpoint
export RCG_ID="${POLICY_ID}/ruleCollectionGroups/${RCG}"
export RCG_URI="https://management.azure.com${RCG_ID}?api-version=2025-05-01"Step 3 — Deploy the rules
az rest \
--method put \
--uri "$RCG_URI" \
--headers "Content-Type=application/json" \
--body @firewall-rules.jsonStep 4 — Verify rule deployment
az rest \
--method get \
--uri "$RCG_URI" \
--query "properties.ruleCollections[].{Name:name,Priority:priority,Action:action.type}" \
--output tableThe expected collections are:
Allow-Spoke-TCP
Allow-Approved-HTTPSCheck the provisioning state:
az rest \
--method get \
--uri "$RCG_URI" \
--query "properties.provisioningState" \
--output tsvContinue when the state is Succeeded.
Rule processing considerations
Our spoke-to-spoke traffic will be evaluated using the TCP network rule.
The HTTPS request to www.microsoft.com will be evaluated using an application rule.
Traffic that matches no applicable allow rule will be denied by default.
This is the principle of least privilege in action.
Lab 8 — Configure User Defined Routes
The next step is essential.
Without appropriate routing, packets might bypass our firewall or fail to reach the destination.
We'll create a route table for each spoke and configure Azure Firewall as the next hop.
Both spokes require routing configuration so return traffic follows the expected path.
Step 1 — Create the route tables
az network route-table create \
--resource-group "$RG" \
--name "$RT_A" \
--location "$LOCATION"az network route-table create \
--resource-group "$RG" \
--name "$RT_B" \
--location "$LOCATION"Step 2 — Route Client to Server through the firewall
az network route-table route create \
--resource-group "$RG" \
--route-table-name "$RT_A" \
--name to-server \
--address-prefix "$SPOKE_B_CIDR" \
--next-hop-type VirtualAppliance \
--next-hop-ip-address "$FW_PRIVATE_IP"Step 3 — Route Server to Client through the firewall
az network route-table route create \
--resource-group "$RG" \
--route-table-name "$RT_B" \
--name to-client \
--address-prefix "$SPOKE_A_CIDR" \
--next-hop-type VirtualAppliance \
--next-hop-ip-address "$FW_PRIVATE_IP"Step 4 — Configure the default routes
All other outbound destinations should also use Azure Firewall.
For Spoke A:
az network route-table route create \
--resource-group "$RG" \
--route-table-name "$RT_A" \
--name default-to-firewall \
--address-prefix 0.0.0.0/0 \
--next-hop-type VirtualAppliance \
--next-hop-ip-address "$FW_PRIVATE_IP"For Spoke B:
az network route-table route create \
--resource-group "$RG" \
--route-table-name "$RT_B" \
--name default-to-firewall \
--address-prefix 0.0.0.0/0 \
--next-hop-type VirtualAppliance \
--next-hop-ip-address "$FW_PRIVATE_IP"Step 5 — Associate the route tables
Client subnet:
az network vnet subnet update \
--resource-group "$RG" \
--vnet-name "$VNET_A" \
--name "$SUBNET_A" \
--route-table "$RT_A"Server subnet:
az network vnet subnet update \
--resource-group "$RG" \
--vnet-name "$VNET_B" \
--name "$SUBNET_B" \
--route-table "$RT_B"Step 6 — Inspect the routes
az network route-table route list \
--resource-group "$RG" \
--route-table-name "$RT_A" \
--output tableaz network route-table route list \
--resource-group "$RG" \
--route-table-name "$RT_B" \
--output tableExpected routing:
SPOKE A
10.20.0.0/16 -> Azure Firewall
0.0.0.0/0 -> Azure Firewall
SPOKE B
10.10.0.0/16 -> Azure Firewall
0.0.0.0/0 -> Azure FirewallImportant: The more-specific spoke routes take precedence over the default route. We include both to make the intended internal and internet paths explicit.
Lab 9 — Configure DNS Proxy
Azure Firewall DNS proxy allows the firewall to receive DNS queries from clients and forward them to configured upstream resolvers.
In this workshop, the firewall uses Azure DNS as its default upstream resolver.
The spoke VMs will use the Azure Firewall private IP as their DNS server.
Step 1 — Verify DNS proxy
az network firewall policy show \
--resource-group "$RG" \
--name "$POLICY" \
--query "properties.dnsSettings" \
--output jsonThe configuration should show DNS proxy enabled.
Step 2 — Configure Spoke A DNS
az network vnet update \
--resource-group "$RG" \
--name "$VNET_A" \
--dns-servers "$FW_PRIVATE_IP"Step 3 — Configure Spoke B DNS
az network vnet update \
--resource-group "$RG" \
--name "$VNET_B" \
--dns-servers "$FW_PRIVATE_IP"Step 4 — Verify the DNS settings
az network vnet show \
--resource-group "$RG" \
--name "$VNET_A" \
--query "dhcpOptions.dnsServers" \
--output jsonExpected result: The DNS server list contains the Azure Firewall private IP address.
The virtual machines are not yet deployed, so they will receive the configured VNet DNS settings during provisioning.
If changing the DNS configuration of existing VMs, restart them or renew DHCP as appropriate to apply the new resolver settings.
Lab 10 — Deploy Private Linux Workloads
We will deploy two Ubuntu virtual machines.
Neither VM will have a public IP address.
We will test TCP port 22 between the machines because SSH is available on the selected Ubuntu image.
No direct SSH access from the internet is required.
Step 1 — Create Network Security Groups
az network nsg create \
--resource-group "$RG" \
--name "$NSG_A" \
--location "$LOCATION"az network nsg create \
--resource-group "$RG" \
--name "$NSG_B" \
--location "$LOCATION"Step 2 — Allow private SSH traffic on Server VM
az network nsg rule create \
--resource-group "$RG" \
--nsg-name "$NSG_B" \
--name Allow-Client-SSH \
--priority 100 \
--direction Inbound \
--access Allow \
--protocol Tcp \
--source-address-prefixes "$SPOKE_A_CIDR" \
--destination-address-prefixes "*" \
--destination-port-ranges 22This rule is limited to the private source network.
Step 3 — Deploy Client VM
az vm create \
--resource-group "$RG" \
--name "$VM_A" \
--location "$LOCATION" \
--image Ubuntu2204 \
--size Standard_B1s \
--admin-username azureuser \
--generate-ssh-keys \
--vnet-name "$VNET_A" \
--subnet "$SUBNET_A" \
--nsg "$NSG_A" \
--nsg-rule NONE \
--public-ip-address ""Step 4 — Deploy Server VM
az vm create \
--resource-group "$RG" \
--name "$VM_B" \
--location "$LOCATION" \
--image Ubuntu2204 \
--size Standard_B1s \
--admin-username azureuser \
--generate-ssh-keys \
--vnet-name "$VNET_B" \
--subnet "$SUBNET_B" \
--nsg "$NSG_B" \
--nsg-rule NONE \
--public-ip-address ""Step 5 — Retrieve private IP addresses
export IP_A=$(az vm show \
-g "$RG" \
-n "$VM_A" \
--show-details \
--query privateIps \
-o tsv)
export IP_B=$(az vm show \
-g "$RG" \
-n "$VM_B" \
--show-details \
--query privateIps \
-o tsv)Display:
echo "Client VM: $IP_A"
echo "Server VM: $IP_B"Checkpoint: Both VMs must be running and must have private IP addresses in their respective subnets.
Lab 11 — Verify Routing and Connectivity
Before introducing failures, let's establish a working baseline.
Step 1 — Retrieve NIC IDs
export NIC_A=$(az vm show \
-g "$RG" \
-n "$VM_A" \
--query "networkProfile.networkInterfaces[0].id" \
-o tsv)
export NIC_B=$(az vm show \
-g "$RG" \
-n "$VM_B" \
--query "networkProfile.networkInterfaces[0].id" \
-o tsv)Step 2 — Inspect Client VM effective routes
az network nic show-effective-route-table \
--ids "$NIC_A" \
--output jsonLook for a route to 10.20.0.0/16 with the Azure Firewall private IP as next hop.
Step 3 — Inspect Server VM effective routes
az network nic show-effective-route-table \
--ids "$NIC_B" \
--output jsonLook for a route back to 10.10.0.0/16 through Azure Firewall.
Step 4 — Test TCP connectivity
az vm run-command invoke \
--resource-group "$RG" \
--name "$VM_A" \
--command-id RunShellScript \
--scripts \
"timeout 8 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS: TCP 22 reachable' || echo 'FAIL: TCP 22 unavailable'" \
--query "value[0].message" \
--output tsvExpected result:
PASS: TCP 22 reachableStep 5 — Test approved HTTPS
az vm run-command invoke \
--resource-group "$RG" \
--name "$VM_A" \
--command-id RunShellScript \
--scripts \
"curl -I --connect-timeout 10 --max-time 25 https://www.microsoft.com" \
--query "value[0].message" \
--output tsvExpected result: A successful HTTPS response from the approved destination.
The exact HTTP status may vary because the website can redirect requests or return other valid application-level responses.
The important observation is that DNS resolves and the TLS connection can be established through the firewall.
Step 6 — Test an unapproved destination
az vm run-command invoke \
--resource-group "$RG" \
--name "$VM_A" \
--command-id RunShellScript \
--scripts \
"curl -I --connect-timeout 8 --max-time 15 https://www.github.com || true" \
--query "value[0].message" \
--output tsvExpected behavior: The request is blocked because no application rule permits this destination.
Depending on the precise request and firewall behavior, the client may see a denial response or a connection failure.
Baseline checkpoint:
Client-to-server TCP 22 succeeds.
Approved HTTPS works.
Unapproved HTTPS is blocked.
DNS resolution works.
Effective routes point through Azure Firewall.
Lab 12 — Configure Azure Firewall Logging
We will now enable resource-specific structured logs.
These logs allow us to investigate which security rules permitted or denied traffic.
The primary tables are:
Log Analytics table | Purpose |
AZFWNetworkRule | Network rule matches and actions |
AZFWApplicationRule | Application rule activity |
AZFWDnsQuery | DNS proxy queries |
Step 1 — Create a Log Analytics workspace
az monitor log-analytics workspace create \
--resource-group "$RG" \
--workspace-name "$LAW" \
--location "$LOCATION" \
--sku PerGB2018 \
--retention-time 30Step 2 — Retrieve the workspace resource ID
export LAW_ID=$(az monitor log-analytics workspace show \
--resource-group "$RG" \
--workspace-name "$LAW" \
--query id \
--output tsv)Step 3 — Retrieve its customer ID
export LAW_CUSTOMER_ID=$(az monitor log-analytics workspace show \
--resource-group "$RG" \
--workspace-name "$LAW" \
--query customerId \
--output tsv)Step 4 — Inspect available diagnostic categories
az monitor diagnostic-settings categories list \
--resource "$FW_ID" \
--output tableConfirm that your firewall exposes the structured categories:
AZFWNetworkRule
AZFWApplicationRule
AZFWDnsQueryStep 5 — Create the diagnostic payload
cat > firewall-diagnostics.json <<'EOF'
[
{
"category": "AZFWNetworkRule",
"enabled": true
},
{
"category": "AZFWApplicationRule",
"enabled": true
},
{
"category": "AZFWDnsQuery",
"enabled": true
}
]
EOFStep 6 — Enable diagnostic logging
az monitor diagnostic-settings create \
--resource "$FW_ID" \
--name "$DIAG" \
--workspace "$LAW_ID" \
--export-to-resource-specific true \
--logs @firewall-diagnostics.jsonStep 7 — Verify the diagnostic setting
az monitor diagnostic-settings list \
--resource "$FW_ID" \
--output jsonImportant: Log ingestion is not instantaneous. Newly enabled tables and their data can take several minutes to appear.
Lab 13 — Query Azure Firewall Logs
We will use Azure CLI to execute KQL queries against Log Analytics.
Step 1 — Query network rule activity
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWNetworkRule
| where TimeGenerated > ago(1h)
| project TimeGenerated, SourceIp, DestinationIp,
DestinationPort, Protocol, Action, Rule
| order by TimeGenerated desc
| take 30
" \
--output tableStep 2 — Query application rule activity
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWApplicationRule
| where TimeGenerated > ago(1h)
| project TimeGenerated, SourceIp, Fqdn,
DestinationPort, Action, Rule
| order by TimeGenerated desc
| take 30
" \
--output tableStep 3 — Query DNS events
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWDnsQuery
| where TimeGenerated > ago(1h)
| take 30
" \
--output tableThese queries provide the foundation for our troubleshooting exercises.
Lab 14 — BREAK #1: Deny Spoke-to-Spoke Traffic
Our first failure simulates an administrator introducing a deny rule that blocks a previously permitted connection.
The existing allow rule permits TCP 22 from Client to Server.
We will create a higher-priority deny collection for that traffic.
Step 1 — Back up the working policy
cp firewall-rules.json firewall-rules-good.jsonStep 2 — Add the deny collection
jq '
.properties.ruleCollections += [
{
"name": "Deny-Spoke-SSH",
"priority": 100,
"ruleCollectionType": "FirewallPolicyFilterRuleCollection",
"action": {
"type": "Deny"
},
"rules": [
{
"name": "Deny-Client-to-Server-SSH",
"ruleType": "NetworkRule",
"ipProtocols": ["TCP"],
"sourceAddresses": ["10.10.1.0/24"],
"destinationAddresses": ["10.20.1.0/24"],
"destinationPorts": ["22"]
}
]
}
]
' firewall-rules-good.json > firewall-rules.jsonStep 3 — Deploy the updated policy
az rest \
--method put \
--uri "$RCG_URI" \
--headers "Content-Type=application/json" \
--body @firewall-rules.jsonVerify the policy update succeeded before testing.
Step 4 — Test connectivity
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"timeout 8 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS' || echo 'FAIL: Connection denied'" \
--query "value[0].message" \
-o tsvExpected:
FAIL: Connection deniedStep 5 — Diagnose the problem
Query network rule logs:
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWNetworkRule
| where TimeGenerated > ago(30m)
| where DestinationPort == 22
| project TimeGenerated, SourceIp, DestinationIp,
Action, RuleCollection, Rule
| order by TimeGenerated desc
" \
--output tableLook for:
Action: Deny
Rule: Deny-Client-to-Server-SSHStep 6 — Repair
Restore the original policy.
cp firewall-rules-good.json firewall-rules.json
az rest \
--method put \
--uri "$RCG_URI" \
--headers "Content-Type=application/json" \
--body @firewall-rules.jsonStep 7 — Verify recovery
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"timeout 8 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS: Repaired' || echo 'FAIL'" \
--query "value[0].message" \
-o tsvExpected:
PASS: RepairedWhat did we learn?
The VMs were running.
The route tables were correct.
VNet peering was connected.
The firewall denied the traffic because a higher-priority rule overrode the original allow rule.
Firewall rule evaluation can cause outages even when the network infrastructure is healthy.
Lab 15 — BREAK #2: Application Rule Failure
Now we'll simulate an outbound HTTPS incident.
Our Client VM can access www.microsoft.com through an application rule.
We will temporarily change the allowed destination to a different FQDN.
Step 1 — Change the application rule
jq '
(
.properties.ruleCollections[]
| select(.name == "Allow-Approved-HTTPS")
| .rules[]
| select(.name == "Allow-Microsoft-HTTPS")
| .targetFqdns
) = ["www.github.com"]
' firewall-rules-good.json > firewall-rules.jsonStep 2 — Deploy the incorrect policy
az rest \
--method put \
--uri "$RCG_URI" \
--headers "Content-Type=application/json" \
--body @firewall-rules.jsonStep 3 — Test approved website access
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"curl -I --connect-timeout 8 --max-time 15 https://www.microsoft.com || true" \
--query "value[0].message" \
-o tsvThe request should now fail because the FQDN is no longer included in our allow rule.
Step 4 — Inspect application logs
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWApplicationRule
| where TimeGenerated > ago(30m)
| where Fqdn contains 'microsoft.com'
| project TimeGenerated, SourceIp, Fqdn,
Action, ActionReason, Rule
| order by TimeGenerated desc
" \
--output tableLook for denied traffic and the default action.
Step 5 — Repair
cp firewall-rules-good.json firewall-rules.json
az rest \
--method put \
--uri "$RCG_URI" \
--headers "Content-Type=application/json" \
--body @firewall-rules.jsonStep 6 — Verify recovery
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"curl -I --connect-timeout 10 --max-time 25 https://www.microsoft.com" \
--query "value[0].message" \
-o tsvExpected: HTTPS connectivity succeeds again.
What did we learn?
Network rules and application rules solve different problems.
Network rules evaluate IP addresses, protocols, and ports.
Application rules can evaluate HTTP/HTTPS traffic using hostnames and supported application-level information.
A DNS lookup succeeding does not mean the firewall will permit the resulting connection.
Lab 16 — BREAK #3: DNS Proxy Failure
Our next scenario introduces a failure in the DNS resolution path.
Both spoke VNets use Azure Firewall as their DNS server.
We will temporarily disable DNS proxy in the Firewall Policy.
Step 1 — Verify DNS baseline
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"getent hosts www.microsoft.com" \
--query "value[0].message" \
-o tsvExpected: The hostname resolves.
Step 2 — Disable DNS proxy
az network firewall policy update \
--resource-group "$RG" \
--name "$POLICY" \
--enable-dns-proxy falseStep 3 — Test name resolution
Flush the local resolver cache before testing:
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"resolvectl flush-caches || true" \
"getent hosts www.microsoft.com || echo 'DNS lookup failed'" \
--query "value[0].message" \
-o tsvExpected behavior: DNS resolution fails after the policy change has propagated.
Step 4 — Diagnose the issue
Inspect the VNet DNS configuration:
az network vnet show \
-g "$RG" \
-n "$VNET_A" \
--query "dhcpOptions.dnsServers" \
-o jsonThe VNet should still be configured to use the firewall private IP.
Now inspect the Firewall Policy:
az network firewall policy show \
-g "$RG" \
-n "$POLICY" \
--query "properties.dnsSettings" \
-o jsonThe DNS proxy setting should indicate that it is disabled.
Step 5 — Repair DNS proxy
az network firewall policy update \
--resource-group "$RG" \
--name "$POLICY" \
--enable-dns-proxy trueStep 6 — Verify recovery
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"resolvectl flush-caches || true" \
"getent hosts www.microsoft.com" \
--query "value[0].message" \
-o tsvExpected: DNS resolution works again.
What did we learn?
An application may appear to have a firewall connectivity problem when the real issue is DNS.
In this scenario:
The network route remains valid.
Firewall application rules remain configured.
The destination service remains available.
DNS queries cannot be answered by the configured proxy.
This is why DNS diagnostics should be a separate step in network troubleshooting.
Lab 17 — BREAK #4: Incorrect User Defined Route
Now we will simulate an incorrect routing change.
Instead of modifying the firewall, we'll modify Spoke A's route table.
The Client VM will no longer have a valid route to the Server VNet.
Step 1 — Review the working route
az network route-table route show \
--resource-group "$RG" \
--route-table-name "$RT_A" \
--name to-server \
--output jsonThe next hop should be Azure Firewall's private IP.
Step 2 — Introduce a blackhole route
az network route-table route update \
--resource-group "$RG" \
--route-table-name "$RT_A" \
--name to-server \
--next-hop-type NoneWe deliberately configure None as the next hop.
This is a routing blackhole, not a firewall deny rule.
Because the route to 10.20.0.0/16 is more specific than the 0.0.0.0/0 default route, Azure selects this blackhole route for traffic to Spoke B.
Step 3 — Verify the new route
az network route-table route show \
--resource-group "$RG" \
--route-table-name "$RT_A" \
--name to-server \
--query "{Prefix:addressPrefix,NextHop:nextHopType}" \
--output tableExpected:
NextHop: NoneStep 4 — Test connectivity
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"timeout 8 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS' || echo 'FAIL: Routing problem'" \
--query "value[0].message" \
-o tsvExpected:
FAIL: Routing problemStep 5 — Inspect effective routes
az network nic show-effective-route-table \
--ids "$NIC_A" \
--output jsonLook for the route to Spoke B.
The selected route should indicate a None next hop after the updated UDR takes effect.
Step 6 — Repair the route
az network route-table route update \
--resource-group "$RG" \
--route-table-name "$RT_A" \
--name to-server \
--next-hop-type VirtualAppliance \
--next-hop-ip-address "$FW_PRIVATE_IP"Step 7 — Verify recovery
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"timeout 8 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS: Routing repaired' || echo 'FAIL'" \
--query "value[0].message" \
-o tsvExpected:
PASS: Routing repairedWhat did we learn?
A firewall cannot inspect traffic that never reaches it.
If an incorrect UDR sends traffic to a blackhole or another next hop, firewall logs may show no corresponding deny event.
In that situation, effective route inspection is more useful than repeatedly changing Firewall Policy rules.
Lab 18 — Advanced Troubleshooting
Let's combine what we've learned into a repeatable incident investigation workflow.
Scenario A — Firewall denies private traffic
Check network rule logs:
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWNetworkRule
| where TimeGenerated > ago(2h)
| where Action == 'Deny'
| project TimeGenerated, SourceIp,
DestinationIp, DestinationPort,
Action, RuleCollection, Rule
| order by TimeGenerated desc
" \
--output tableScenario B — Application access fails
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWApplicationRule
| where TimeGenerated > ago(2h)
| project TimeGenerated, SourceIp,
Fqdn, Action, ActionReason, Rule
| order by TimeGenerated desc
" \
--output tableScenario C — DNS resolution fails
az monitor log-analytics query \
--workspace "$LAW_CUSTOMER_ID" \
--analytics-query "
AZFWDnsQuery
| where TimeGenerated > ago(2h)
| order by TimeGenerated desc
| take 50
" \
--output tableScenario D — No firewall log appears
Inspect:
The VM's effective routes.
The subnet's associated route table.
The destination prefix and next-hop selection.
NSG rules.
Guest operating system firewall settings.
Whether the connection actually traverses Azure Firewall.
Whether the diagnostic settings are enabled and data ingestion has completed.
The absence of a firewall log does not automatically prove that traffic bypassed the firewall. It may also mean no matching diagnostic event was generated or ingested.
Lab 19 — Final End-to-End Verification
Before deleting the environment, let's confirm that all failures have been repaired.
Step 1 — Verify firewall health
az network firewall show \
--resource-group "$RG" \
--name "$FW" \
--query "{Name:name,State:provisioningState}" \
--output tableStep 2 — Verify Firewall Policy
az network firewall policy show \
--resource-group "$RG" \
--name "$POLICY" \
--query "{
Name:name,
DNS:properties.dnsSettings,
SKU:sku.tier
}" \
--output jsonDNS proxy should be enabled.
Step 3 — Verify rule collections
az rest \
--method get \
--uri "$RCG_URI" \
--query "properties.ruleCollections[].{Name:name,Priority:priority,Action:action.type}" \
--output tableOnly the original intended allow collections should remain.
Step 4 — Verify effective routes
az network nic show-effective-route-table \
--ids "$NIC_A" \
--output jsonConfirm the route to Spoke B points to Azure Firewall.
Step 5 — Verify private connectivity
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"timeout 8 bash -c 'echo >/dev/tcp/${IP_B}/22' && echo 'PASS' || echo 'FAIL'" \
--query "value[0].message" \
-o tsvStep 6 — Verify DNS
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"getent hosts www.microsoft.com" \
--query "value[0].message" \
-o tsvStep 7 — Verify HTTPS
az vm run-command invoke \
-g "$RG" \
-n "$VM_A" \
--command-id RunShellScript \
--scripts \
"curl -I --connect-timeout 10 --max-time 25 https://www.microsoft.com" \
--query "value[0].message" \
-o tsvExpected final state
Component | Expected |
Azure Firewall | Succeeded |
Firewall Policy | Deployed |
DNS Proxy | Enabled |
Hub-spoke peering | Connected |
Client route table | Correct next hop |
Server route table | Correct next hop |
Private TCP 22 | Allowed |
Approved HTTPS | Allowed |
Unapproved HTTPS | Denied |
Network rule logs | Available after ingestion |
Application rule logs | Available after ingestion |
DNS proxy logs | Available after ingestion |
Lab 20 — Cleanup
The workshop uses billable Azure Firewall infrastructure.
Delete it when you finish.
Step 1 — Review deployed resources
az resource list \
--resource-group "$RG" \
--query "[].{Name:name,Type:type}" \
--output tableStep 2 — Delete the resource group
az group delete \
--name "$RG" \
--yesThis deletes the workshop environment, including:
Azure Firewall.
Firewall Policy.
Firewall public IP.
Hub and spoke VNets.
VNet peerings.
Route tables.
Network Security Groups.
Linux VMs.
Managed disks.
Log Analytics workspace.
Diagnostic settings associated with the firewall.
Step 3 — Verify deletion
az group exists \
--name "$RG"Expected:
falseStep 4 — Remove local JSON files
rm -f firewall-rules.json
rm -f firewall-rules-good.json
rm -f firewall-diagnostics.jsonCleanup complete.
Workshop Review — What Have We Learned?
Technology | Learning outcome |
Azure Firewall Standard | Centralized traffic inspection |
Azure Firewall Policy | Centralized security rules |
Hub-and-spoke networking | Segmented network topology |
VNet peering | Hub-spoke connectivity and forwarding |
Network rules | Filtering based on IP, protocol, and port |
Application rules | FQDN-based HTTP/HTTPS control |
DNS proxy | Centralized DNS resolution |
User Defined Routes | Forcing traffic through Azure Firewall |
Azure Monitor | Firewall telemetry |
Log Analytics | Structured traffic investigations |
KQL | Finding allowed and denied connections |
Azure CLI | End-to-end network management |
Four failures, four lessons
Failure 1 — Network Rule Deny
The network is reachable from a routing perspective, but Azure Firewall denies traffic because of a higher-priority security rule.
Failure 2 — Application Rule Misconfiguration
DNS resolution works, but the requested FQDN is not permitted by the Firewall Policy.
Failure 3 — DNS Proxy Outage
Firewall rules and routes remain configured, but the client cannot resolve hostnames through its configured DNS server.
Failure 4 — Incorrect UDR
Traffic is blackholed before it reaches Azure Firewall.
The absence of a firewall deny entry is an important troubleshooting clue.
Final Challenge — Test Your Knowledge
Before finishing, consider these questions.
Why does VNet peering not automatically provide spoke-to-spoke transit?
Why must forwarded traffic be allowed on hub-spoke peerings?
What is the difference between a network rule and an application rule?
Why does Azure Firewall require its own dedicated subnet?
What is the purpose of the Azure Firewall private IP?
Why must both spoke networks have appropriate return-path routing?
How does DNS proxy interact with FQDN-based filtering?
Why might TCP fail even when the DNS lookup succeeds?
What does it mean when the firewall reports Deny in its network rule logs?
Why might a routing failure produce no firewall log?
What is the difference between a traffic-processing failure and a management-plane provisioning failure?
Bonus challenges
Challenge 1 — Add a third spoke
Deploy another VNet and configure a separate rule collection allowing only approved management traffic.
Challenge 2 — Implement DNAT
Configure a controlled inbound DNAT rule and test access to a private workload. Keep the destination service hardened and restrict the source IP ranges.
Challenge 3 — Add Firewall Policy hierarchy
Create a parent Firewall Policy and a child policy, then investigate how inherited rules and priorities affect traffic.
Challenge 4 — Explore FQDN network rules
Use Azure Firewall DNS proxy with FQDN-based network rules and compare their behavior with HTTPS application rules.
Challenge 5 — Build a KQL monitoring dashboard
Create reusable queries that report the most frequently denied destinations, most active source addresses, and top matching security rules.
Challenge 6 — Compare Azure Firewall Standard and Premium
Investigate features such as TLS inspection, IDPS, and advanced threat protection, including their operational and cost implications.
Conclusion
Azure Firewall is more than a centralized filtering service.
It is a critical component in the routing, security, and operational visibility of enterprise Azure environments.
A successful deployment does not guarantee that your traffic follows the expected path.
And a blocked connection does not automatically mean that Azure Firewall is responsible.
In this workshop, we deployed a complete hub-and-spoke environment, configured centralized Firewall Policy rules, enabled DNS proxy, forced routing through Azure Firewall, and collected traffic logs in Log Analytics.
We then deliberately introduced four different failures.
Each failure required a different troubleshooting approach.
A deny rule was identified through firewall logs.
An application rule misconfiguration was diagnosed using FQDN-based inspection.
A DNS proxy problem was isolated through resolver testing.
An incorrect route was discovered through effective route inspection.
The most important lesson is that successful Azure network troubleshooting requires understanding both routing and security policy evaluation.
Deploy. Secure. Route. Break. Diagnose. Repair. Verify.
Official Microsoft Documentation
Azure Workshopz | Beyond Cloud with Chriz
Hands-on Azure infrastructure workshops focused on deployment, security, troubleshooting, and recovery.
Comments