Gateway subnets should not have a network security group
Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.
Gateway subnets should not have a network security group is an Azure guardrail written in Azure Policy. Denies a network security group on a gateway subnet. What it breaks: you cannot filter gateway subnet traffic with an NSG while this applies; the definition states that an NSG on a gateway subnet makes the gateway stop functioning.
More network perimeter guardrails ยท About Azure Policy
Built-in policy definition: Gateway subnets should not be configured with a network security group
Definition ID: 35f9c03a-cc27-418e-9c0c-539ff999d010
Category: Network
Supported effects: deny
policyRule (copied from the repository file):
{
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/virtualNetworks/subnets"
},
{
"field": "name",
"equals": "GatewaySubnet"
},
{
"field": "Microsoft.Network/virtualNetworks/subnets/networkSecurityGroup.id",
"exists": "true"
}
]
},
"then": {
"effect": "deny"
}
}
- Blocks
- Denies a network security group on a gateway subnet.
- Breaks
- You cannot filter gateway subnet traffic with an NSG while this applies; the definition states that an NSG on a gateway subnet makes the gateway stop functioning. (source)
- Test before applying
- As for every Azure Policy guardrail: how to test before enforcing
- Mechanism
- Azure Policy (built-in definitions): Resources at the scope of the assignment (management group, subscription, resource group) and their children, except notScopes and exemptions
- Taken from
- open source set, MIT License, Azure/azure-policy repository, https://raw.githubusercontent.com/Azure/azure-policy/master/LICENSE
What the source says
"This policy denies if a gateway subnet is configured with a network security group." (read 10 Nov 2026).
On what it breaks: "Assigning a network security group to a gateway subnet will cause the gateway to stop functioning."
Related guardrails
- Prevent creating or expanding public connectivity for VPCsAWS, Service control policies (SCPs), network perimeter
- Block internet gateway ingress for VPCs (declarative policy)AWS, Declarative policies, network perimeter
- Skip default network creationGoogle Cloud, Organization Policy Service (managed and legacy constraints), network perimeter
- Network interfaces should disable IP forwardingAzure, Azure Policy (built-in definitions), network perimeter
- Configure key vaults to enable the firewallAzure, Azure Policy (built-in definitions), network perimeter
Related pages
Sources
- Gateway subnets should not have a network security group, read 10 Nov 2026
- How to test it first, read 10 Nov 2026
Last reviewed 16 Nov 2026.