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

```text
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](https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-policies/policyDefinitions/Network/NetworkSecurityGroupOnGatewaySubnet_Deny.json))
- **Test before applying:** As for every Azure Policy guardrail: [how to test before enforcing](/mechanisms/azure-policy/)
- **Mechanism:** [Azure Policy (built-in definitions)](/mechanisms/azure-policy/): Resources at the scope of the assignment (management group, subscription, resource group) and their children, except notScopes and exemptions
- **Taken from:** [open source set](https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-policies/policyDefinitions/Network/NetworkSecurityGroupOnGatewaySubnet_Deny.json), 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 VPCs](/guardrails/aws-scp-prevent-vpc-public-connectivity/): AWS, Service control policies (SCPs), network perimeter
- [Block internet gateway ingress for VPCs (declarative policy)](/guardrails/aws-declarative-vpc-block-public-access/): AWS, Declarative policies, network perimeter
- [Skip default network creation](/guardrails/gcp-orgpolicy-skip-default-network/): Google Cloud, Organization Policy Service (managed and legacy constraints), network perimeter
- [Network interfaces should disable IP forwarding](/guardrails/azure-policy-nic-no-ip-forwarding/): Azure, Azure Policy (built-in definitions), network perimeter
- [Configure key vaults to enable the firewall](/guardrails/azure-policy-keyvault-firewall/): Azure, Azure Policy (built-in definitions), network perimeter

## Related pages

- [Configure storage accounts to disallow public blob access (Azure Azure Policy)](/guardrails/azure-policy-storage-disable-public-blob/)
- [Storage accounts should disable public network access (Azure Azure Policy)](/guardrails/azure-policy-storage-disable-public-network/)
- [Storage accounts should have the specified minimum TLS version (Azure Azure Policy)](/guardrails/azure-policy-storage-min-tls/)

## Sources

- Gateway subnets should not have a network security group: https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-policies/policyDefinitions/Network/NetworkSecurityGroupOnGatewaySubnet_Deny.json (read 10 Nov 2026)
- How to test it first: https://learn.microsoft.com/en-us/azure/governance/policy/concepts/assignment-structure (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/azure-policy-gateway-subnet-no-nsg/
