Gallery › App Service › Azure built-in policies
App Service app slots should enable outbound application traffic routing to Azure Virtual Network
Converted Policy Audit Deny Disabled Mode Indexed Version 1.2.0
By default, regional VNET integration routes only RFC1918 traffic. Set 'vnetRouteAllEnabled' (API < 2024-11-01) or 'outboundVnetRouting.applicationTraffic' (API >= 2024-11-01) to route application traffic via the virtual network. Alternatively, set 'outboundVnetRouting.allTraffic' to route all traffic. Configuration traffic is handled separately by the configuration routing policy.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONWebApp_Slot_VnetRouteAllEnabled_Audit.json · 84 lines
{
"properties": {
"displayName": "App Service app slots should enable outbound application traffic routing to Azure Virtual Network",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "By default, regional VNET integration routes only RFC1918 traffic. Set 'vnetRouteAllEnabled' (API < 2024-11-01) or 'outboundVnetRouting.applicationTraffic' (API >= 2024-11-01) to route application traffic via the virtual network. Alternatively, set 'outboundVnetRouting.allTraffic' to route all traffic. Configuration traffic is handled separately by the configuration routing policy.",
"metadata": {
"version": "1.2.0",
"category": "App Service"
},
"version": "1.2.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites/slots"
},
{
"field": "kind",
"notContains": "functionapp"
},
{
"anyOf": [
{
"allOf": [
{
"value": "[requestContext().apiVersion]",
"less": "2024-11-01"
},
{
"field": "Microsoft.Web/sites/slots/vnetRouteAllEnabled",
"notEquals": "true"
}
]
},
{
"allOf": [
{
"value": "[requestContext().apiVersion]",
"greaterOrEquals": "2024-11-01"
},
{
"field": "Microsoft.Web/sites/slots/outboundVnetRouting.applicationTraffic",
"notEquals": "true"
},
{
"field": "Microsoft.Web/sites/slots/outboundVnetRouting.allTraffic",
"notEquals": "true"
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.2.0",
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/f5c0bfb3-acea-47b1-b477-b0edcdf6edc1",
"name": "f5c0bfb3-acea-47b1-b477-b0edcdf6edc1"
}Bylawf5c0bfb3-acea-47b1-b477-b0edcdf6edc1.bylaw.ps1 · 44 lines
# Converted from WebApp_Slot_VnetRouteAllEnabled_Audit.json by ConvertTo-Bylaw.
Policy 'f5c0bfb3-acea-47b1-b477-b0edcdf6edc1' {
Properties @{
DisplayName = 'App Service app slots should enable outbound application traffic routing to Azure Virtual Network'
Description = 'By default, regional VNET integration routes only RFC1918 traffic. Set ''vnetRouteAllEnabled'' (API < 2024-11-01) or ''outboundVnetRouting.applicationTraffic'' (API >= 2024-11-01) to route application traffic via the virtual network. Alternatively, set ''outboundVnetRouting.allTraffic'' to route all traffic. Configuration traffic is handled separately by the configuration routing policy.'
Version = '1.2.0'
Category = 'App Service'
PolicyVersion = '1.2.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites/slots' {
When {
Field kind | Must -Not -ContainText 'functionapp'
}
Require 'vnetRouteAllEnabled is as required' {
AnyOf {
Arm '[requestContext().apiVersion]' | Must -BeGreaterOrEqual '2024-11-01'
Field vnetRouteAllEnabled | Must -Be 'true'
}
}
Require 'outboundVnetRouting.applicationTraffic and outboundVnetRouting.allTraffic are as required' {
AnyOf {
Arm '[requestContext().apiVersion]' | Must -BeLessThan '2024-11-01'
Field outboundVnetRouting.applicationTraffic | Must -Be 'true'
Field outboundVnetRouting.allTraffic | Must -Be 'true'
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/App Service/WebApp_Slot_VnetRouteAllEnabled_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw