Which Azure network security service filters network traffic to and from Azure resources using rules based on source, destination, port, and protocol?
Network Security Groups (NSGs) contain security rules that allow or deny inbound and outbound traffic to Azure resources. Each rule specifies source and destination IP ranges, port ranges, and protocol (TCP, UDP, or any), with a priority that determines evaluation order. NSGs are stateful, meaning return traffic is automatically allowed, and they can be associated with subnets or virtual machine network interfaces. This makes them the ideal, low-cost, and granular tool for basic network traffic filtering in Azure.
Why this answer
Network Security Groups (NSGs) are the correct answer because they filter network traffic to and from Azure resources at the subnet or network interface level using rules that specify source, destination, port, and protocol. NSGs operate as a distributed, stateful firewall that evaluates each packet against a set of allow or deny rules, making them the primary tool for granular network traffic control within a virtual network.
Exam trap
The trap here is that candidates often confuse Azure Firewall with NSGs because both perform filtering, but Azure Firewall is a centralized, managed service for advanced scenarios (e.g., inspecting outbound traffic to the internet), while NSGs are the correct answer for basic, rule-based filtering at the resource or subnet level.
How to eliminate wrong answers
Option A is wrong because Azure Firewall is a fully managed, centralized network firewall service that provides advanced features like application FQDN filtering and threat intelligence, but it is not the service that filters traffic using simple rules based on source, destination, port, and protocol at the resource level—that is the role of NSGs. Option B is wrong because Azure DDoS Protection is a service designed to protect against distributed denial-of-service attacks by analyzing traffic patterns and mitigating volumetric attacks, not by filtering traffic based on source, destination, port, and protocol rules. Option D is wrong because Azure WAF (Web Application Firewall) is a service that protects web applications from common exploits like SQL injection and cross-site scripting by inspecting HTTP/HTTPS traffic, not by filtering network traffic based on source, destination, port, and protocol.