Gallery › Network › Azure Landing Zones Library
Deny or Audit service endpoints on subnets
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This Policy will deny/audit Service Endpoints on subnets. Service Endpoints allows the network traffic to bypass Network appliances, such as the Azure Firewall.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-Service-Endpoints.alz_policy_definition.json · 58 lines
{
"name": "Deny-Service-Endpoints",
"properties": {
"description": "This Policy will deny/audit Service Endpoints on subnets. Service Endpoints allows the network traffic to bypass Network appliances, such as the Azure Firewall.",
"displayName": "Deny or Audit service endpoints on subnets",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Network",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Network/virtualNetworks/subnets",
"field": "type"
},
{
"count": {
"field": "Microsoft.Network/virtualNetworks/subnets/serviceEndpoints[*]",
"where": {
"exists": true,
"field": "Microsoft.Network/virtualNetworks/subnets/serviceEndpoints[*].service"
}
},
"greater": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-Service-Endpoints.bylaw.ps1 · 30 lines
# Converted from Deny-Service-Endpoints.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-Service-Endpoints' {
Properties @{
DisplayName = 'Deny or Audit service endpoints on subnets'
Description = 'This Policy will deny/audit Service Endpoints on subnets. Service Endpoints allows the network traffic to bypass Network appliances, such as the Azure Firewall.'
Category = 'Network'
Version = '1.0.0'
Mode = 'All'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Network/virtualNetworks/subnets' {
Require 'serviceEndpoints and service are as required' {
Each 'serviceEndpoints[*]' {
Field service | Must -Not -Exist
}
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-Service-Endpoints.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw