Network Controls & VPN
NSGs and ASGs · Virtual Network Manager security admin rules · Virtual WAN security · P2S and S2S VPN security · Network Watcher diagnostics
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Network security groups (NSGs)
An NSG holds rules that allow or deny inbound traffic to, or outbound traffic from, several types of Azure resources. Rules are matched on source, source port, destination, destination port and protocol.
| Setting | What to know |
|---|---|
| Rule priority | A number between 100 and 4096. Lower numbers are processed first and processing stops at the first match. |
| Same priority | You can't create two rules with the same priority and direction. |
| Default rules | AllowVNetInBound (65000), AllowAzureLoadBalancerInBound (65001), DenyAllInbound (65500); AllowVnetOutBound (65000), AllowInternetOutBound (65001), DenyAllOutBound (65500). You can't remove them, but you can override them with rules that have a higher priority (a lower number). |
| Source or destination | Any, an IP address, a CIDR block, a service tag or an application security group. A single rule can't list several service tags or ASGs; augmented security rules allow several IP addresses and ranges in one rule. |
| State | NSGs are stateful: a flow record lets return traffic through without a rule of its own. |
| Rule changes | Rule changes affect new connections only. Removing the rule that allowed an SSH session leaves that session connected; a new SSH attempt is blocked. |
Where the NSG is applied
- Inbound: Azure processes the NSG on the subnet first, then the NSG on the network interface.
- Outbound: Azure processes the NSG on the network interface first, then the NSG on the subnet.
- A deny-all rule in the subnet NSG can stop VMs in the same subnet from reaching each other.
- Microsoft advises against associating NSGs with both a subnet and its network interfaces, because rules at several levels can conflict and are hard to troubleshoot.
Exam trap: Azure default rules have the lowest priority so your custom rules are always processed first. To override a default allow, add a custom Deny with a lower priority number; don't try to delete the default rule.
Application security groups (ASGs)
An ASG groups VMs (by network interface) so NSG rules can name the application tier instead of IP addresses. A rule that names an ASG applies only to network interfaces that are members of it.
- All network interfaces in an ASG must be in the same virtual network as the first network interface added to it.
- If an ASG is both source and destination of a rule, the network interfaces of both ASGs must be in the same virtual network.
- A network interface can be a member of several ASGs, up to the Azure limits.
- AllowVNetInBound allows all traffic inside the virtual network, so you add an explicit Deny (for example to a database ASG) and a higher-priority Allow for the tier that needs access.
Azure Virtual Network Manager: security admin rules
Security admin rules are global network security rules that Azure Virtual Network Manager enforces on the virtual networks of a network group. They are evaluated before NSG rules.
| Item | Security admin rules | NSG rules |
|---|---|---|
| Owner | Central network or governance team | Application or service teams |
| Applied on | Virtual networks | Subnets and network interfaces |
| Evaluation | Higher priority, evaluated first | After security admin rules |
| Actions | Allow, Always allow, Deny | Allow, Deny |
| Priority range | 1 to 4,096 (lower number wins) | 100 to 4096 |
- Allow: evaluated first, then traffic continues to the NSG rules, which can still deny it.
- Always allow and Deny end evaluation after the security admin rule: Always allow goes straight to the resource, Deny stops the traffic.
- Only one security admin configuration can be deployed to a region. Add more rule collections to the same configuration; multiple connectivity configurations can exist in a region.
- Security admin rules can't apply to virtual networks the network manager doesn't manage. A network manager's scope is a set of management groups and/or subscriptions; a virtual network outside it can be added to a group, but the configuration isn't applied to it.
- By default security admin rules aren't applied to virtual networks that contain Azure SQL Managed Instances or Azure Databricks. Subnets that hold Application Gateway, Bastion, Firewall, Route Server, VPN Gateway, Virtual WAN or ExpressRoute gateway aren't affected either.
- They don't apply to private endpoints in a managed virtual network's scope. Deployment is eventually consistent, so rules reach resources after a short delay.
- Use them to block high-risk ports from outside, such as 3389 (RDP) and 22 (SSH).
Network groups
| Static membership | Dynamic membership | |
|---|---|---|
| Selection | You manually select individual virtual networks from the manager's scope. | Azure Policy evaluates conditions; matching virtual networks join. |
| Azure Policy | Not required | Required |
| Permissions | RBAC permissions to join the network group | RBAC to join the group, plus read and write on the underlying policy |
| Best fit | A small, stable set of virtual networks | Many virtual networks, or membership driven by a condition such as a tag |
A network group is a global container for virtual networks from any region, and one virtual network can be in several groups. You can't create multiple network managers with an overlapping scope of the same hierarchy and the same features selected.
Azure Virtual WAN security
- A secured hub is a Virtual WAN hub with Azure Firewall. Convert a hub from the hub page (Azure Firewall and Firewall Manager under Security); the portal conversion doesn't allow Availability Zones for the firewall. Upgrading Standard to Premium needs a maintenance window because of minimal downtime.
- Routing intent sets declarative routing policies that send traffic to bump-in-the-wire security solutions such as Azure Firewall, network virtual appliances or SaaS security solutions in the hub.
- Each hub can have at most one Internet Traffic Routing Policy and one Private Traffic Routing Policy, each with a single next hop.
- A Private Traffic Routing Policy sends branch-to-branch, branch-to-virtual network, virtual network-to-branch and inter-hub traffic through the hub's next hop.
- Internet traffic must leave through the local hub's security solution, because the default route 0.0.0.0/0 doesn't propagate across hubs.
- Routing intent can't be used on hubs with custom route tables, or with static routes in the defaultRouteTable whose next hop is a virtual network connection.
Exam trap: A Private policy covers branches and virtual networks together. An Internet policy covers Internet-bound traffic only.
VPN security
Point-to-site (P2S) authentication
| Tunnel type | Authentication mechanism |
|---|---|
| OpenVPN | Any subset of Microsoft Entra ID, RADIUS and Azure certificate |
| SSTP | RADIUS or Azure certificate |
| IKEv2 | RADIUS or Azure certificate |
| IKEv2 and OpenVPN | RADIUS, Azure certificate, or Microsoft Entra ID with RADIUS or certificate |
| IKEv2 and SSTP | RADIUS or Azure certificate |
- P2S needs a route-based VPN type. SSTP is a proprietary TLS-based protocol and is supported only on Windows.
- Certificate authentication: you upload the trusted root certificate public key to the gateway, and each client needs a client certificate generated from that root.
- Microsoft Entra ID authentication: supported only for OpenVPN, and clients must use the Azure VPN Client. It lets you use Conditional Access and MFA for VPN.
- A P2S gateway supports only one Audience value. Granular access by user group needs several gateways, each with its own custom app ID.
- Basic SKU and policy-based VPN types aren't supported for P2S with Microsoft Entra ID authentication. The Basic SKU also doesn't support IPv6.
- A Microsoft-registered Azure VPN Client App ID skips the manual app registration in your tenant.
Site-to-site (S2S) IPsec/IKE policy
- A custom IPsec/IKE policy works on VpnGw1-5, VpnGw1AZ-5AZ, Standard and HighPerformance gateway SKUs.
- Only one policy combination per connection; you must specify all IKE (Main Mode) and IPsec (Quick Mode) algorithms and parameters. Partial specification isn't allowed.
- If you use GCMAES for IPsec encryption, use the same GCMAES algorithm and key length for IPsec integrity.
- The on-premises device must match the algorithms and parameters, or the connection can't be established.
Network Watcher: evaluate effective rules
| Tool | Use it to | Limits |
|---|---|---|
| IP flow verify | Check whether a packet to or from a VM is allowed or denied by NSG rules and Virtual Network Manager admin rules, and which rule decides. | Tests TCP and UDP only; tests rules for a VM's network interface (not scale sets); needs a Network Watcher instance in the VM's subscription and region. |
| NSG diagnostics | Simulate a flow from a source and destination and see the rule that allows or denies it. | Use it for ICMP and for scale-set network interfaces; targets include VMs, network interfaces, scale-set network interfaces and Application Gateway v2 (except private deployments). |
| Next hop | Get the next hop type, IP address and route table ID for a destination. | Returns System Route when no user-defined route applies. |
IP flow verify returns Access allowed or Access denied, the rule name and the NSG with a link to edit it. It gives no link when a default security rule decides.
Exam Tips
Tick each tip once you can answer it without looking.
“Override a default NSG allow rule such as AllowVNetInBound” → Add a custom rule with a priority number lower than 65000. Trap: Default rules can't be removed. Custom rules use 100 to 4096, and two rules can't share a priority and direction.
“Which NSG is evaluated first for inbound traffic when the subnet and NIC both have one?” → The subnet NSG, then the NIC NSG. Trap: Outbound is the reverse: NIC NSG first, then the subnet NSG.
“A rule allowing SSH is deleted while a session is open” → The open session stays up; new connections are blocked. Trap: NSG changes affect new connections only.
“ASG members in different virtual networks” → Not allowed: all NICs in an ASG must be in the same virtual network as the first one. Trap: A NIC can belong to several ASGs, but an ASG can't span virtual networks.
“A rule needs several service tags as the source” → Not possible in one rule; augmented rules allow several IP ranges, not several tags or ASGs. Trap: Create separate rules for each service tag.
“Central team must block RDP everywhere, even where app teams allow it in NSGs” → Security admin rule with the Deny action in a Virtual Network Manager security admin configuration. Trap: An Allow security admin rule still goes on to the NSG rules; Always allow bypasses them and permits traffic.
“Second set of security admin rules in the same region” → Add another rule collection to the existing security admin configuration. Trap: Only one security admin configuration can be deployed per region.
“Virtual network outside the network manager scope is in a network group” → The configuration isn't applied to it; widen the scope or use a manager that covers it. Trap: Adding it to the group only records intent.
“Virtual networks join a group automatically by tag or other condition” → Dynamic membership (Azure Policy). Trap: Static membership is manual selection; scope only defines what the manager can manage.
“Security admin rules not applied to a subnet” → The subnet holds a service such as Firewall, Bastion, VPN Gateway, Application Gateway (without network isolation), Route Server, Virtual WAN or an ExpressRoute gateway. Trap: For whole virtual networks, SQL Managed Instance and Databricks are skipped by default.
“All branch, VNet and inter-hub traffic through the hub firewall” → Private Traffic Routing Policy (routing intent). Trap: An Internet policy only covers Internet-bound traffic, and a hub can have just one of each policy type.
“Routing intent can't be enabled on a Virtual WAN hub” → Custom route tables, or static routes with a virtual network connection as next hop, exist; remove them. Trap: Routing intent can't coexist with custom route tables.
“P2S VPN with Conditional Access and MFA” → OpenVPN + Microsoft Entra ID authentication + Azure VPN Client. Trap: IKEv2 and SSTP don't work with Entra ID authentication; SSTP is Windows-only.
“Different user groups to different P2S gateways” → One gateway and one custom audience app ID per group. Trap: A gateway supports a single Audience value.
“S2S custom IPsec/IKE policy” → One complete policy per connection (IKE and IPsec), on a supported SKU. Trap: Partial policies and Basic SKU aren't supported.
“Test whether ICMP is allowed by NSG rules” → NSG diagnostics. Trap: IP flow verify tests TCP and UDP only.
Sources
- Network security groups overview
- How NSGs filter network traffic
- Application security groups
- Security admin rules in Virtual Network Manager
- Network groups
- Virtual Network Manager scopes
- Install Azure Firewall in a Virtual WAN hub
- Virtual WAN hub routing policies
- About P2S VPN connections
- P2S access based on users and groups
- Custom IPsec/IKE policies
- VPN Gateway SKUs
- IP flow verify
- NSG diagnostics
- Next hop
- Configure P2S VPN gateway for Microsoft Entra ID authentication: Microsoft-registered client
Checked against Microsoft Learn on November 13, 2026.