network, between subnets and VMs, internet traffic, and additional Azure
services, such as storage.
Individual security rules can allow or deny inbound or outbound traffic to or
from various Azure resources, and are grouped into NSGs that can then be
assigned to the following:
A single network interface, allowing filtered network traffic on a singular interface
An entire subnet, allowing filtered traffic on all the network interfaces in the subnet
Both the network interface and the subnet, allowing each NSG to be independently evaluated for the
application of security rules
The security rules are based on the following properties:
A Name value that is unique within the NSG
The source/destination IP address or range , which can be any, an individual IP address, a
Classless Inter-Domain Routing (CIDR) block, a service tag (covered in the upcoming Overview of
Azure service tags section), or an ASG
The priority by which the rules are processed in order, from a value between 100 and 4,096
The protocol that the traffic is using, be it TCP, UDP, ICMP, ESP, AH, or any
The direction of traffic, determining inbound or outbound traffic
The port range, which allows you to specify a range of ports (or a wildcard *) used to minimize the
overall amount of security rules created or managed
The action, which results in either Allow or Deny
THE EVALUATION OF SECURITY RULES
Note that security rules are evaluated and applied based on five-tuple information, using the source,
source port, destination, destination port, and protocol. If the network traffic is a match for an existing
security rule, that specific rule is used for the traffic, and the remaining security rules are not evaluated for
that network traffic. Additional traffic that has not yet matched will evaluate against additional security
rules.
NSGs notably have three inbound and three outbound default security rules
that cannot be modified (as outlined in this Microsoft documentation:
https://learn.microsoft.com/azure/virtual-network/network-security-groups-
overview), but you can create your own higher priority rules to override these
defaults based on your organizational requirements. These six default rules
allow outbound communication to the internet, allow communication within a
virtual network and Azure Load Balancer, and deny all inbound traffic from
the internet. The default rules are described in the following table: