Gallery › App Service › Azure built-in policies
App Service apps should enable configuration routing to Azure Virtual Network
Converted Policy Audit Deny Disabled Mode Indexed Version 1.2.0
By default, configuration traffic (image pull, content share, backup/restore) is not routed through regional VNET integration. For API < 2024-11-01, set 'vnetImagePullEnabled', 'vnetContentShareEnabled', 'vnetBackupRestoreEnabled' to true. For API >= 2024-11-01, set the corresponding 'outboundVnetRouting' properties or 'outboundVnetRouting.allTraffic' to true. Learn more: https://aka.ms/appservice-vnet-configuration-routing.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "App Service apps should enable configuration routing to Azure Virtual Network",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "By default, configuration traffic (image pull, content share, backup/restore) is not routed through regional VNET integration. For API < 2024-11-01, set 'vnetImagePullEnabled', 'vnetContentShareEnabled', 'vnetBackupRestoreEnabled' to true. For API >= 2024-11-01, set the corresponding 'outboundVnetRouting' properties or 'outboundVnetRouting.allTraffic' to true. Learn more: https://aka.ms/appservice-vnet-configuration-routing.",
"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"
},
{
"field": "kind",
"notContains": "functionapp"
},
{
"anyOf": [
{
"allOf": [
{
"value": "[requestContext().apiVersion]",
"less": "2024-11-01"
},
{
"anyOf": [
{
"field": "Microsoft.Web/sites/vnetImagePullEnabled",
"notEquals": "true"
},
{
"field": "Microsoft.Web/sites/vnetContentShareEnabled",
"notEquals": "true"
},
{
"field": "Microsoft.Web/sites/vnetBackupRestoreEnabled",
"notEquals": "true"
}
]
}
]
},
{
"allOf": [
{
"value": "[requestContext().apiVersion]",
"greaterOrEquals": "2024-11-01"
},
{
"field": "Microsoft.Web/sites/outboundVnetRouting.allTraffic",
"notEquals": "true"
},
{
"anyOf": [
{
"field": "Microsoft.Web/sites/outboundVnetRouting.imagePullTraffic",
"notEquals": "true"
},
{
"field": "Microsoft.Web/sites/outboundVnetRouting.contentShareTraffic",
"notEquals": "true"
},
{
"field": "Microsoft.Web/sites/outboundVnetRouting.backupRestoreTraffic",
"notEquals": "true"
}
]
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.2.0",
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/801543d1-1953-4a90-b8b0-8cf6d41473a5",
"name": "801543d1-1953-4a90-b8b0-8cf6d41473a5"
}# Converted from WebApp_VnetConfigurationRouting_Audit.json by ConvertTo-Bylaw.
Policy '801543d1-1953-4a90-b8b0-8cf6d41473a5' {
Properties @{
DisplayName = 'App Service apps should enable configuration routing to Azure Virtual Network'
Description = 'By default, configuration traffic (image pull, content share, backup/restore) is not routed through regional VNET integration. For API < 2024-11-01, set ''vnetImagePullEnabled'', ''vnetContentShareEnabled'', ''vnetBackupRestoreEnabled'' to true. For API >= 2024-11-01, set the corresponding ''outboundVnetRouting'' properties or ''outboundVnetRouting.allTraffic'' to true. Learn more: https://aka.ms/appservice-vnet-configuration-routing.'
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' {
When {
Field kind | Must -Not -ContainText 'functionapp'
}
Require 'vnetImagePullEnabled, vnetContentShareEnabled and vnetBackupRestoreEnabled are as required' {
AnyOf {
Arm '[requestContext().apiVersion]' | Must -BeGreaterOrEqual '2024-11-01'
AllOf {
Field vnetImagePullEnabled | Must -Be 'true'
Field vnetContentShareEnabled | Must -Be 'true'
Field vnetBackupRestoreEnabled | Must -Be 'true'
}
}
}
Require 'outboundVnetRouting.allTraffic, outboundVnetRouting.imagePullTraffic, outboundVnetRouting.contentShareTraffic and 1 more are as required' {
AnyOf {
Arm '[requestContext().apiVersion]' | Must -BeLessThan '2024-11-01'
Field outboundVnetRouting.allTraffic | Must -Be 'true'
AllOf {
Field outboundVnetRouting.imagePullTraffic | Must -Be 'true'
Field outboundVnetRouting.contentShareTraffic | Must -Be 'true'
Field outboundVnetRouting.backupRestoreTraffic | Must -Be 'true'
}
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/App Service/WebApp_VnetConfigurationRouting_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw