Gallery › App Service › Azure built-in policies
App Service app slots should be injected into a virtual network
Converted Policy Audit Deny Disabled Mode Indexed Version 1.3.0
Injecting App Service Apps in a virtual network unlocks advanced App Service networking and security features and provides you with greater control over your network security configuration. Learn more at: https://docs.microsoft.com/azure/app-service/web-sites-integrate-with-vnet.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONApp_Slot_VNetIntegrationEnabled_Audit.json · 65 lines
{
"properties": {
"displayName": "App Service app slots should be injected into a virtual network",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Injecting App Service Apps in a virtual network unlocks advanced App Service networking and security features and provides you with greater control over your network security configuration. Learn more at: https://docs.microsoft.com/azure/app-service/web-sites-integrate-with-vnet.",
"metadata": {
"version": "1.3.0",
"category": "App Service"
},
"version": "1.3.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": [
{
"field": "Microsoft.Web/sites/slots/virtualNetworkSubnetId",
"exists": false
},
{
"field": "Microsoft.Web/sites/slots/virtualNetworkSubnetId",
"equals": ""
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.3.0",
"1.2.0",
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/24b7a1c6-44fe-40cc-a2e6-242d2ef70e98",
"name": "24b7a1c6-44fe-40cc-a2e6-242d2ef70e98"
}Bylaw24b7a1c6-44fe-40cc-a2e6-242d2ef70e98.bylaw.ps1 · 37 lines
# Converted from App_Slot_VNetIntegrationEnabled_Audit.json by ConvertTo-Bylaw.
Policy '24b7a1c6-44fe-40cc-a2e6-242d2ef70e98' {
Properties @{
DisplayName = 'App Service app slots should be injected into a virtual network'
Description = 'Injecting App Service Apps in a virtual network unlocks advanced App Service networking and security features and provides you with greater control over your network security configuration. Learn more at: https://docs.microsoft.com/azure/app-service/web-sites-integrate-with-vnet.'
Version = '1.3.0'
Category = 'App Service'
PolicyVersion = '1.3.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 'virtualNetworkSubnetId exists' {
Field virtualNetworkSubnetId | Must -Exist
}
Require 'virtualNetworkSubnetId is not' {
Field virtualNetworkSubnetId | Must -Not -Be '' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/App Service/App_Slot_VNetIntegrationEnabled_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw