Back to Blog
5 min read

Azure Firewall: Network Security Fundamentals

Azure Firewall provides cloud-native network security with built-in high availability and scalability. It is a fully stateful firewall as a service with threat intelligence-based filtering.

Core Features

FeatureDescription
L3-L7 filteringNetwork and application layer filtering
FQDN filteringFilter by fully qualified domain names
Threat intelligenceBlock known malicious IPs and domains
NAT supportDNAT and SNAT capabilities
DNS proxyCustom DNS with filtering
Forced tunnelingRoute all traffic through on-premises

Creating Azure Firewall

# Create firewall subnet (must be named AzureFirewallSubnet)
az network vnet subnet create \
    --name AzureFirewallSubnet \
    --resource-group myRG \
    --vnet-name hub-vnet \
    --address-prefixes 10.0.1.0/24

# Create public IP
az network public-ip create \
    --name fw-pip \
    --resource-group myRG \
    --allocation-method Static \
    --sku Standard

# Create firewall
az network firewall create \
    --name my-firewall \
    --resource-group myRG \
    --location eastus

# Configure IP
az network firewall ip-config create \
    --firewall-name my-firewall \
    --resource-group myRG \
    --name fw-config \
    --public-ip-address fw-pip \
    --vnet-name hub-vnet

Network Rules

# Create network rule collection
az network firewall network-rule create \
    --firewall-name my-firewall \
    --resource-group myRG \
    --collection-name AllowInternet \
    --name AllowHTTPS \
    --protocols TCP \
    --source-addresses 10.0.0.0/8 \
    --destination-addresses '*' \
    --destination-ports 443 \
    --action Allow \
    --priority 200

Application Rules (FQDN Filtering)

# Allow specific FQDNs
az network firewall application-rule create \
    --firewall-name my-firewall \
    --resource-group myRG \
    --collection-name AllowWeb \
    --name AllowMicrosoft \
    --source-addresses 10.0.0.0/8 \
    --protocols Http=80 Https=443 \
    --fqdn-tags WindowsUpdate MicrosoftActiveProtectionService \
    --action Allow \
    --priority 100

FQDN Tags

Built-in tags for common services:

TagDescription
WindowsUpdateWindows Update endpoints
WindowsDiagnosticsWindows diagnostic services
MicrosoftActiveProtectionServiceWindows Defender
AppServiceEnvironmentASE management
AzureBackupAzure Backup services
HDInsightHDInsight cluster management
AzureKubernetesServiceAKS management

NAT Rules (DNAT)

# Create DNAT rule for RDP access
az network firewall nat-rule create \
    --firewall-name my-firewall \
    --resource-group myRG \
    --collection-name AllowRDP \
    --name RDPtoVM1 \
    --source-addresses '*' \
    --destination-addresses <firewall-public-ip> \
    --destination-ports 3389 \
    --protocols TCP \
    --translated-address 10.0.2.4 \
    --translated-port 3389 \
    --action Dnat \
    --priority 100

Threat Intelligence

# Enable threat intelligence filtering
az network firewall update \
    --name my-firewall \
    --resource-group myRG \
    --threat-intel-mode Alert  # or Deny

DNS Settings

# Configure DNS proxy
az network firewall update \
    --name my-firewall \
    --resource-group myRG \
    --dns-servers 168.63.129.16 \
    --enable-dns-proxy true

Route Traffic Through Firewall

# Create route table
az network route-table create \
    --name spoke-routes \
    --resource-group myRG \
    --location eastus

# Add default route to firewall
az network route-table route create \
    --route-table-name spoke-routes \
    --resource-group myRG \
    --name ToFirewall \
    --address-prefix 0.0.0.0/0 \
    --next-hop-type VirtualAppliance \
    --next-hop-ip-address <firewall-private-ip>

# Associate with spoke subnet
az network vnet subnet update \
    --name workload-subnet \
    --vnet-name spoke-vnet \
    --resource-group myRG \
    --route-table spoke-routes

Diagnostic Logs

# Enable logging to Log Analytics
az monitor diagnostic-settings create \
    --name firewall-logs \
    --resource /subscriptions/.../azureFirewalls/my-firewall \
    --logs '[{
        "category": "AzureFirewallApplicationRule",
        "enabled": true
    },{
        "category": "AzureFirewallNetworkRule",
        "enabled": true
    },{
        "category": "AzureFirewallDnsProxy",
        "enabled": true
    }]' \
    --workspace /subscriptions/.../workspaces/my-logs

KQL Queries

// Application rule hits
AzureDiagnostics
| where Category == "AzureFirewallApplicationRule"
| parse msg_s with Protocol " request from " SourceIP ":" SourcePort " to " FQDN ":" * ". Action: " Action "." *
| project TimeGenerated, Protocol, SourceIP, FQDN, Action
| order by TimeGenerated desc

// Network rule hits
AzureDiagnostics
| where Category == "AzureFirewallNetworkRule"
| parse msg_s with Protocol " request from " SourceIP ":" SourcePort " to " DestIP ":" DestPort ". Action: " Action
| project TimeGenerated, Protocol, SourceIP, DestIP, DestPort, Action
| order by TimeGenerated desc

// Threat intelligence blocks
AzureDiagnostics
| where Category == "AzureFirewallApplicationRule" or Category == "AzureFirewallNetworkRule"
| where msg_s contains "ThreatIntel"
| project TimeGenerated, msg_s

Hub-Spoke Architecture

                    ┌─────────────────┐
                    │   On-Premises   │
                    └────────┬────────┘
                             │ VPN/ExpressRoute
                    ┌────────┴────────┐
                    │    Hub VNet     │
                    │ ┌─────────────┐ │
                    │ │   Azure     │ │
                    │ │  Firewall   │ │
                    │ └─────────────┘ │
                    └───────┬─────────┘
              ┌─────────────┼─────────────┐
              │             │             │
        ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐
        │  Spoke 1  │ │  Spoke 2  │ │  Spoke 3  │
        │  (Web)    │ │  (App)    │ │  (Data)   │
        └───────────┘ └───────────┘ └───────────┘

Pricing

  • Deployment: $1.25/hour ($912/month)
  • Data processing: $0.016/GB

Best Practices

  1. Use firewall policies: Centralize rule management
  2. Implement least privilege: Only allow required traffic
  3. Enable logging: Critical for security auditing
  4. Use FQDN tags: Simplify management for known services
  5. Plan IP addressing: Consider growth in subnet sizing
  6. Monitor costs: Data processing can add up

Azure Firewall: cloud-native network security without the complexity.

Resources

Michael John Peña

Michael John Peña

Senior Data Engineer based in Sydney. Writing about data, cloud, and technology.