Skip to content
Cloud Governance Tools

Gateway subnets should not have a network security group

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."

Sources

  1. Gateway subnets should not have a network security group, read 10 Nov 2026
  2. How to test it first, read 10 Nov 2026

Last reviewed 16 Nov 2026.