The 3 default Azure Network Security (NSG) rules
You can use an Azure network security group to filter network traffic between Azure resources in an Azure virtual network. A network security group contains security rules that allow or deny inbound network traffic to, or outbound network traffic from, several types of Azure resources. For each rule, you can specify source and destination, port, and protocol.
Default security rules
Azure creates the following default rules in each network security group that you create:
Inbound
AllowVNetInBound
Priority | Source | Source ports | Destination | Destination ports | Protocol | Access |
---|---|---|---|---|---|---|
65000 | VirtualNetwork | 0-65535 | VirtualNetwork | 0-65535 | Any | Allow |
Priority | Source | Source ports | Destination | Destination ports | Protocol | Access |
---|---|---|---|---|---|---|
65001 | AzureLoadBalancer | 0-65535 | 0.0.0.0/0 | 0-65535 | Any | Allow |
Priority | Source | Source ports | Destination | Destination ports | Protocol | Access |
---|---|---|---|---|---|---|
65500 | 0.0.0.0/0 | 0-65535 | 0.0.0.0/0 | 0-65535 | Any | Deny |
Outbound
AllowVnetOutBound
Priority | Source | Source ports | Destination | Destination ports | Protocol | Access |
---|---|---|---|---|---|---|
65000 | VirtualNetwork | 0-65535 | VirtualNetwork | 0-65535 | Any | Allow |
AllowInternetOutBound
Priority | Source | Source ports | Destination | Destination ports | Protocol | Access |
---|---|---|---|---|---|---|
65001 | 0.0.0.0/0 | 0-65535 | Internet | 0-65535 | Any | Allow |
DenyAllOutBound
Priority | Source | Source ports | Destination | Destination ports | Protocol | Access |
---|---|---|---|---|---|---|
65500 | 0.0.0.0/0 | 0-65535 | 0.0.0.0/0 | 0-65535 | Any | Deny |
In the Source and Destination columns, VirtualNetwork, AzureLoadBalancer, and Internet are service tags, rather than IP addresses. In the protocol column, Any encompasses TCP, UDP, and ICMP. When creating a rule, you can specify TCP, UDP, ICMP or Any. 0.0.0.0/0 in the Source and Destination columns represents all addresses. Clients like Azure portal, Azure CLI, or PowerShell can use * or any for this expression.
You can’t remove the default rules, but you can override them by creating rules with higher priorities.
Rules
AllowVnetInBound – This rule permits all the hosts inside the virtual network (including subnets) to communicate between them without any blocks.
AllowAzureLoadBalancerInBound – This rule allows an Azure load balancer to communicate with your VM and send heartbeats.
DenyAllInBound – This is the deny all rule that blocks any inbound traffic to the VM by default and protect the VM from malicious access outside the Azure Vnet.