Last active
June 20, 2022 08:12
-
-
Save joxz/87db69131709ca8b3ad85db8712d9864 to your computer and use it in GitHub Desktop.
Azure Policy Collection
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
{ | |
"mode": "All", | |
"policyRule": { | |
"if": { | |
"allOf": [ | |
{ | |
"field": "type", | |
"equals": "Microsoft.Network/networkInterfaces" | |
}, | |
{ | |
"anyOf": [ | |
{ | |
"count": { | |
"field": "Microsoft.Network/networkInterfaces/dnsSettings.appliedDnsServers[*]" | |
}, | |
"greater": 0 | |
}, | |
{ | |
"count": { | |
"field": "Microsoft.Network/networkInterfaces/dnsSettings.dnsServers[*]" | |
}, | |
"greater": 0 | |
} | |
] | |
} | |
] | |
}, | |
"then": { | |
"effect": "audit" | |
} | |
} | |
} |
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
{ | |
"mode": "All", | |
"policyRule": { | |
"if": { | |
"allOf": [ | |
{ | |
"field": "type", | |
"equals": "Microsoft.Network/publicIPAddresses" | |
}, | |
{ | |
"field": "Microsoft.Network/publicIPAddresses/publicIPAllocationMethod", | |
"equals": "Static" | |
}, | |
{ | |
"field": "Microsoft.Network/publicIPAddresses/ipConfiguration", | |
"exists": false | |
} | |
] | |
}, | |
"then": { | |
"effect": "audit" | |
} | |
}, | |
"parameters": {} | |
} |
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
{ | |
"mode": "All", | |
"policyRule": { | |
"if": { | |
"not": { | |
"field": "Microsoft.Network/virtualNetworks/dhcpOptions.dnsServers[*]", | |
"in": "[parameters('allowedDns')]" | |
} | |
}, | |
"then": { | |
"effect": "audit" | |
} | |
}, | |
"parameters": { | |
"allowedDns": { | |
"type": "Array", | |
"metadata": { | |
"displayName": "Allowed DNS Servers", | |
"description": "The list of allowed DNS Servers for resources." | |
} | |
} | |
} | |
} |
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
{ | |
"mode": "All", | |
"policyRule": { | |
"if": { | |
"field": "type", | |
"equals": "Microsoft.Network/ddosProtectionPlans" | |
}, | |
"then": { | |
"effect": "deny" | |
} | |
}, | |
"parameters": {} | |
} |
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
{ | |
"mode": "Indexed", | |
"policyRule": { | |
"if": { | |
"anyOf": [ | |
{ | |
"allOf": [ | |
{ | |
"equals": "Microsoft.Network/routeTables", | |
"field": "type" | |
}, | |
{ | |
"count": { | |
"field": "Microsoft.Network/routeTables/routes[*]", | |
"where": { | |
"equals": "Internet", | |
"field": "Microsoft.Network/routeTables/routes[*].nextHopType" | |
} | |
}, | |
"greater": 0 | |
} | |
] | |
}, | |
{ | |
"allOf": [ | |
{ | |
"equals": "Microsoft.Network/routeTables/routes", | |
"field": "type" | |
}, | |
{ | |
"equals": "Internet", | |
"field": "Microsoft.Network/routeTables/routes/nextHopType" | |
} | |
] | |
} | |
] | |
}, | |
"then": { | |
"effect": "[parameters('effect')]" | |
} | |
}, | |
"parameters": { | |
"effect": { | |
"type": "String", | |
"metadata": { | |
"displayName": "Effect", | |
"description": "The effect of the policy" | |
}, | |
"allowedValues": [ | |
"audit", | |
"deny", | |
"disabled" | |
], | |
"defaultValue": "deny" | |
} | |
} | |
} |
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
{ | |
"mode": "All", | |
"policyRule": { | |
"if": { | |
"field": "type", | |
"equals": "Microsoft.Network/privateDnsZones" | |
}, | |
"then": { | |
"effect": "deny" | |
} | |
}, | |
"parameters": {} | |
} | |
// exclude the RG and subscription where deploying private dns zones is allowed from the policy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment