Skip to content

Instantly share code, notes, and snippets.

@ljtill
Last active September 28, 2021 10:56
Show Gist options
  • Save ljtill/12505089b12f4dfcaca07a721910b01f to your computer and use it in GitHub Desktop.
Save ljtill/12505089b12f4dfcaca07a721910b01f to your computer and use it in GitHub Desktop.
Provides the ability to modify Security Rules upon Resource updates
{
"displayName": "",
"policyType": "Custom",
"mode": "All",
"parameters": {},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/networkSecurityGroups"
},
{
"count": {
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*]",
"where": {
"allOf": [
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].name",
"equals": ""
}
]
}
},
"equals": 0
}
]
},
"then": {
"effect": "append",
"details": [
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*]",
"value": {
"name": "",
"properties": {
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "",
"sourceAddressPrefixes": [
"10.1.0.0/16"
],
"destinationAddressPrefix": "VirtualNetwork",
"destinationAddressPrefixes": [],
"access": "Deny",
"priority": "4096",
"direction": "Inbound"
}
}
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment