Last active
October 21, 2019 14:01
-
-
Save zmilleson/71aad6f90c155830ae52e10b14e9b448 to your computer and use it in GitHub Desktop.
Azure Policy - Require NSGs on all subnets except GatewaySubnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "Microsoft.Authorization/policyDefinitions", | |
"name": "enforce-nsg-on-subnet-except-gatewaysubnet", | |
"properties": { | |
"displayName": "NSG X on every subnet except GatewaySubnet", | |
"description": "This policy enforces a specific NSG on every subnet except the GatewaySubnet", | |
"mode": "All", | |
"parameters": {}, | |
"policyRule": { | |
"if": { | |
"allOf": [ | |
{ | |
"field": "type", | |
"equals": "Microsoft.Network/virtualNetworks/subnets" | |
}, | |
{ | |
"anyOf": [ | |
{ | |
"field": "name", | |
"notequals": "GatewaySubnet" | |
} | |
] | |
}, | |
{ | |
"field": "Microsoft.Network/virtualNetworks/subnets/networkSecurityGroup.id", | |
"exists": "false" | |
} | |
] | |
}, | |
"then": { | |
"effect": "audit" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment