The one-line verdict: a Network Security Group (NSG) is a free, basic filter you attach to a subnet or NIC; Azure Firewall is a paid, managed firewall for a whole virtual network. The exam plays on the mix-up between them, so fix the difference once and the questions answer themselves.
The core difference
Both control network traffic in Microsoft Azure, but they sit at different scales. An NSG is a set of allow/deny rules working on layer 3/4 — source and destination IP, port and protocol. You bind it to a subnet or a NIC, and it filters traffic to and from that resource. It is a free feature, which makes it the default tool for basic segmentation.
Azure Firewall is a managed, stateful, centralized firewall service — a paid Azure resource you deploy once to protect an entire virtual network. On top of IP/port rules it adds application and FQDN rules (allow traffic to *.windows.net but nothing else), threat intelligence-based filtering against known-bad addresses, and central logging. The diagram above lines the two up column by column: the free per-resource filter on the left, the managed network-wide appliance on the right.
Where the exam probes
The AZ-900 questions almost always hinge on one of four tells. Read the scenario for these signals:
- “Free” or “no extra cost” → NSG. The firewall is always a billed resource.
- “A single VM” / “a subnet” → NSG. Its scope is a NIC or a subnet.
- “Central” / “the whole VNet” / “managed” → Azure Firewall.
- “FQDN rules”, “application rules”, “threat intelligence” → Azure Firewall. An NSG has none of these.
They are not rivals
The trap answer is “use only one.” In practice the two are used together: NSGs do cheap micro-segmentation between tiers inside the network, while Azure Firewall is the single central egress point for outbound internet traffic, where the logging and threat feed matter most. A question that describes both needs — per-tier rules and one controlled exit — wants both services, not a choice between them.
Don’t confuse them with these
Two more distractors show up next to this pair. Microsoft Defender for Cloud assesses your security posture and makes recommendations — it does not filter packets. Azure Policy governs which resources may exist and how they are configured, not the traffic between them. Keep the lane clear: NSG and Azure Firewall move packets; Defender scores you; Policy governs resources.
How to use the questions below
Answer each one before you open the explanation, and when you miss, read past the correct option to why the others are wrong — the distractors here are the right-sounding neighbour offered for the wrong reason. Getting the tell right (“free” versus “central and managed”) is what carries into the exam. For the wider services picture, see the Azure architecture and services domain; for the governance pair people mix up next, the Azure Policy vs RBAC page.
Updated for AZ-900 (July 2026). The sample questions above are our own work
in the style of the exam — not real exam items. The exam itself is set and marked
by the certification body.