output/20260723_081532/govviz/ALZ_20260723_081601/Enterprise-Scale/src/resources/Microsoft.Authorization/policyDefinitions/Deny-Subnet-Without-Penp.json
|
{ "name": "Deny-Subnet-Without-Penp", "type": "Microsoft.Authorization/policyDefinitions", "apiVersion": "2021-06-01", "scope": null, "properties": { "policyType": "Custom", "mode": "All", "displayName": "Subnets without Private Endpoint Network Policies enabled should be denied", "description": "This policy denies the creation of a subnet without Private Endpoint Netwotk Policies enabled. This policy is intended for 'workload' subnets, not 'central infrastructure' (aka, 'hub') subnets.", "metadata": { "version": "1.2.0", "category": "Network", "source": "https://github.com/Azure/Enterprise-Scale/", "alzCloudEnvironments": [ "AzureCloud", "AzureChinaCloud", "AzureUSGovernment" ] }, "parameters": { "effect": { "type": "String", "allowedValues": [ "Audit", "Deny", "Disabled" ], "defaultValue": "Deny", "metadata": { "displayName": "Effect", "description": "The effect determines what happens when the policy rule is evaluated to match" } }, "excludedSubnets": { "type": "Array", "metadata": { "displayName": "Excluded Subnets", "description": "Array of subnet names that are excluded from this policy" }, "defaultValue": [ "GatewaySubnet", "AzureFirewallSubnet", "AzureFirewallManagementSubnet", "AzureBastionSubnet", "RouteServerSubnet" ] }, "penpValue": { "type": "String", "allowedValues": [ "Disabled", "NetworkSecurityGroupEnabled", "RouteTableEnabled", "Enabled" ], "defaultValue": "Enabled", "metadata": { "displayName": "Private Endpoint Network Policies Value", "description": "The privateEndpointNetworkPolicies value required for evaluated subnets" } } }, "policyRule": { "if": { "anyOf": [ { "allOf": [ { "equals": "Microsoft.Network/virtualNetworks", "field": "type" }, { "count": { "field": "Microsoft.Network/virtualNetworks/subnets[*]", "where": { "allOf": [ { "field": "Microsoft.Network/virtualNetworks/subnets[*].privateEndpointNetworkPolicies", "notEquals": "[[parameters('penpValue')]" }, { "field": "Microsoft.Network/virtualNetworks/subnets[*].name", "notIn": "[[parameters('excludedSubnets')]" } ] } }, "notEquals": 0 } ] }, { "allOf": [ { "field": "type", "equals": "Microsoft.Network/virtualNetworks/subnets" }, { "field": "name", "notIn": "[[parameters('excludedSubnets')]" }, { "field": "Microsoft.Network/virtualNetworks/subnets/privateEndpointNetworkPolicies", "notEquals": "[[parameters('penpValue')]" } ] } ] }, "then": { "effect": "[[parameters('effect')]" } } } } |