SC-500 Which one when · Part 0

NSG vs Azure Firewall vs WAF: Stop Mixing Them Up

Four Azure network controls that the SC-500 exam loves to mix up: what each one does, when to use which, and how they look in a real lab.

· 6 min read

Slide comparing NSG, Azure Firewall, WAF and private endpoint: what each does and when to use it
Watch the lesson: Part 0: Understand it first, the role, defence in depth, which tool when, and cost | SC-500

The exam rarely asks what a tool is. It asks which tool fits. In networking, four controls come up again and again, and they sound alike: network security groups, Azure Firewall, a web application firewall, and private endpoints.

Here is the short version, then each one as it looks in the SC-500 lab.

Table: NSG allow or deny by IP and port on every subnet; Azure Firewall central rules for many networks; WAF blocks web attacks; private endpoint gives a private IP for a PaaS service
From Part 0 of the course: what each control does, and when to use it.
Control Does Use it when
NSG allows or denies traffic by IP and port on every subnet
Azure Firewall central rules by FQDN, plus threat intelligence many networks share one exit
WAF blocks web attacks such as SQL injection public web apps
Private endpoint gives a PaaS service a private IP there must be no public access at all

Network security group: the basic fence

An NSG filters by priority (100 to 4096, lowest first), source, destination, port and protocol. Its default rules allow traffic inside the virtual network and deny everything else inbound. With application security groups you write rules by role, web to app on port 8080, and they keep working whatever the IP addresses become.

NSG inbound rules: Allow-web-to-app on port 8080 from asg-sc500-web to asg-sc500-app, priority 100
One rule by role: the web tier may reach the app tier on 8080. NSGs and ASGs cost nothing.

If there is an NSG on both the subnet and the network card, traffic must pass both.

Private endpoint: no public door at all

A private endpoint is a network card in your subnet with a private address, connected to one part of one service: a key vault, a blob service, a SQL server. Then you can turn public access off on the service itself.

The step people miss is DNS. Without the private DNS zone, the name still resolves to the public address and the traffic never uses the endpoint.

Private endpoint DNS configuration: the key vault name resolves to a private 10.0.0.x address through privatelink.vaultcore.azure.net
The vault's name now maps to a private address in our network, through the privatelink zone.

Service endpoint or private endpoint? A service endpoint is free and works per subnet, but the service keeps its public address. A private endpoint gives each resource a private address that also works from on-premises and peered networks.

Azure Firewall: one exit for many networks

The firewall lives in a hub network; application networks are spokes, and a route table sends their traffic to the firewall’s private address. A firewall policy holds the rules: DNAT first, then network rules, then application rules.

Firewall policy application rules: collection allow-web-outbound, priority 200, allowing HTTPS from the dispatch network
An application rule collection in the policy. One policy can serve many firewalls.

Tiers matter for the exam: Basic for small sites (threat intelligence can only alert), Standard adds threat-intelligence deny, DNS proxy and web categories, and Premium adds TLS inspection, IDPS and full URL filtering. A firewall is billed by the hour even with no traffic, so in the lab we create it and delete it in the same lesson.

WAF: stop attacks inside the web request

An NSG or firewall sees IPs, ports and names. A web application firewall reads the HTTP request itself and blocks SQL injection, cross-site scripting and bad bots before they reach the app. In Part 7 we put it in prevention mode and add a custom rule against the sqlmap tool.

Log Analytics query of the Application Gateway firewall log showing matched and blocked SQL injection rules
The proof: every attack in the firewall log, with the rule that matched or blocked it.

How to choose, in one line each

  • Need to filter traffic between subnets? NSG (with ASGs).
  • Need one controlled exit to the internet for many networks? Azure Firewall in a hub.
  • Have a public website or API? Put a WAF in front of it.
  • Must a PaaS service never be reachable publicly? Private endpoint, private DNS zone, then public access off.

They are not alternatives; they are layers. A real design uses all four, which is exactly defence in depth.

Exam tip: when the scenario says prevent, think policy, a firewall or guardrails. When it says detect, think Defender plans or Sentinel.

Do it yourself

Lab guides, practice and full mock exams come with a subscription. See the plans