liveBook · Manning

Security rule

As explained in Microsoft Azure in Action

A security rule is an ordered network-filtering rule that specifies traffic criteria and an allow or deny action.

A security rule filters traffic entering or leaving a network security group (NSG). It matches traffic by port, protocol, source, and destination, then allows or denies it. NSGs can protect a subnet or an individual VM through its network interface. section 4.3

The important settings are:

  • Priority runs from the lowest number to the highest; once a rule matches, later rules do not process that packet. section 4.3
  • Port accepts a number from 0 to 65,535 or Any, while protocol accepts TCP, UDP, or Any. section 4.3
  • Sources and destinations can be Any, an IP address, a CIDR range, or an Azure service tag. section 4.3
  • Action is Allow or Deny; overlapping rules deserve careful priorities, or the rule list can become network spaghetti. section 4.3

Allowing remote desktop

An Azure PowerShell configuration adds an inbound allowRDP rule for TCP port 3389, restricted to a specified source address, with priority 300. section 4.3

Table 4.3 Inbound security rules for a default NSG

Priority

Name

Port

Protocol

Source

Destination

Action

300

SSH

22

TCP

Any

Any

Allow

65000

AllowVNetInbound

Any

Any

VNet

VNet

Allow

65001

AllowAzureLoad­Balancer InBound

Any

Any

Azure Load Balancer

Any

Allow

65002

DenyAllInbound

Any

Any

Any

Any

Deny

Compare a default NSG's SSH allow rule with its built-in VNet, load-balancer, and deny-all rules. section 4.3

How Microsoft Azure in Action covers it

How deep it goes
Defines matching fields, ordered evaluation, default rules, and overlap risks without detailing packet-processing internals.
Examples
Uses default SSH and deny-all rules plus an Azure PowerShell rule allowing restricted inbound RDP.
What you can do after
Operate/configure it with Azure PowerShell by creating an NSG, attaching it to a subnet, and adding prioritized rules.
How it connects
Connects network security groups with subnets, network interface cards, routing tables, service tags, and virtual machines.

Also explained in

Compare how 2 books explain security rule →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microsoft Azure in Action. The section links point to the parts of the book it draws on.