Azure Firewall - A Comprehensive Guide

Azure Firewall is a managed, cloud-native network security service that protects resources running in an Azure Virtual Network. It provides centralized policy management and high availability without requiring you to manage the underlying infrastructure.

Key Features of Azure Firewall

  • Stateful Filtering — inspects and filters traffic based on rules that track the state of active connections
  • Built-in High Availability — no need to configure separate load balancers for the firewall itself
  • FQDN Filtering — allows or denies outbound traffic based on fully qualified domain names
  • Threat Intelligence — can automatically block traffic to and from known malicious IP addresses and domains
  • Centralized Policy Management — using Firewall Policy, rules can be managed centrally across multiple firewalls

How Azure Firewall Works

Azure Firewall is deployed into a dedicated subnet within a Virtual Network. All traffic entering or leaving the network can be routed through the firewall, which evaluates it against network rules, application rules, and NAT rules before allowing or blocking it.

Types of Rules

  • Network Rules — control traffic based on source/destination IP, port, and protocol
  • Application Rules — control outbound traffic based on fully qualified domain names (FQDNs)
  • NAT Rules — translate and filter inbound traffic to internal resources

Common Use Cases

  • Centrally securing outbound internet access for multiple virtual networks and subscriptions
  • Filtering traffic to specific trusted domains for compliance requirements
  • Protecting hub-and-spoke network architectures from a single, centralized firewall in the hub
Azure Firewall works well alongside Network Security Groups (NSGs) — NSGs typically handle basic subnet/NIC-level filtering, while Azure Firewall provides centralized, more advanced traffic control across the network.

Ready to master Microsoft Azure?

Join Microsoft Azure Training Course at Uncodemy and learn with hands-on projects and mentor support.

Explore the Course

Deploying Azure Firewall: The Basic Flow

A typical first deployment follows a predictable sequence. Understanding the order helps you avoid the classic situation where the firewall exists but no traffic ever reaches it.

  1. Create the subnet. The firewall needs its own subnet named exactly AzureFirewallSubnet inside the virtual network, usually the hub network.
  2. Create a public IP address. The firewall uses a Standard SKU public IP for outbound traffic and for inbound NAT.
  3. Create a Firewall Policy. Group your rules into rule collection groups and rule collections, each with a priority number. Lower numbers are processed first.
  4. Deploy the firewall and attach the policy to it.
  5. Add a route table. On each workload subnet, create a user-defined route that sends 0.0.0.0/0 to the firewall's private IP as the next hop. Without this step, traffic bypasses the firewall completely.
  6. Turn on diagnostic logging to a Log Analytics workspace so you can see allowed and denied flows.

Example with Azure CLI

az network firewall policy create \
  --name hub-fw-policy --resource-group rg-network

az network firewall policy rule-collection-group create \
  --name app-rules --policy-name hub-fw-policy \
  --resource-group rg-network --priority 200

az network route-table route create \
  --resource-group rg-network --route-table-name rt-workload \
  --name default-to-fw --address-prefix 0.0.0.0/0 \
  --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.1.4

Here 10.0.1.4 stands in for your firewall's private IP. Check the real value on the firewall's overview page.

How Rules Are Evaluated

Inside a policy, rule collection groups are processed by priority, and within them rule collections are processed by priority too. Broadly, DNAT rules are checked first, then network rules, then application rules. If a network rule matches, application rules are not evaluated for that traffic. If nothing matches, the traffic is denied by default. This default-deny behaviour is a good thing, but it means you must allow every legitimate flow explicitly.

Azure Firewall, NSGs or a Third-Party Appliance?

OptionGood Choice When
Network Security GroupYou need simple allow/deny by IP and port on a subnet or VM
Azure FirewallYou need central control, FQDN filtering and logging across many networks
Third-party virtual applianceYour team already standardises on a specific vendor's features and tooling

Many designs use NSGs and Azure Firewall together: NSGs as a local guard, the firewall as the central checkpoint. Compare the available firewall SKUs in the official documentation before choosing, since features such as TLS inspection and IDPS depend on the tier.

Common Configuration Mistakes

  • Forgetting the route table, so the firewall sees no traffic.
  • Writing one huge "allow any" rule to fix a broken app, which removes the protection you deployed it for.
  • Allowing web traffic by IP when the destination changes IPs often; use FQDN rules or service tags instead.
  • Skipping logs, then having no evidence when you need to troubleshoot a blocked connection.

Takeaway: route traffic through it, start from deny, allow only what each workload needs, and review the logs regularly.