Gallery › Mission › Azure built-in policies
App Service app slots should disable public network access.
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Disable public network access for your App Services.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAppSlotNetAccess_Audit.json · 66 lines
{
"properties": {
"displayName": "App Service app slots should disable public network access.",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Disable public network access for your App Services.",
"metadata": {
"version": "1.0.0",
"category": "Mission"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites/slots"
},
{
"exists": "false",
"field": "Microsoft.Web/sites/slots/hostingEnvironmentProfile.id"
},
{
"field": "Microsoft.Web/sites/slots/publicNetworkAccess",
"equals": "Enabled"
},
{
"anyOf": [
{
"field": "Microsoft.Web/sites/slots/siteConfig.ipSecurityRestrictionsDefaultAction",
"equals": "Allow"
},
{
"field": "Microsoft.Web/sites/slots/siteConfig.scmIpSecurityRestrictionsDefaultAction",
"equals": "Allow"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0e3ccb86-ad68-43a5-8cd0-42035638b199",
"name": "0e3ccb86-ad68-43a5-8cd0-42035638b199"
}Bylaw0e3ccb86-ad68-43a5-8cd0-42035638b199.bylaw.ps1 · 37 lines
# Converted from AppSlotNetAccess_Audit.json by ConvertTo-Bylaw.
Policy '0e3ccb86-ad68-43a5-8cd0-42035638b199' {
Properties @{
DisplayName = 'App Service app slots should disable public network access.'
Description = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Disable public network access for your App Services.'
Version = '1.0.0'
Category = 'Mission'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites/slots' {
When {
Field hostingEnvironmentProfile.id | Must -Not -Exist
Field publicNetworkAccess | Must -Be 'Enabled'
}
Require 'siteConfig.ipSecurityRestrictionsDefaultAction is not Allow' {
Field siteConfig.ipSecurityRestrictionsDefaultAction | Must -Not -Be 'Allow' -IfPresent
}
Require 'siteConfig.scmIpSecurityRestrictionsDefaultAction is not Allow' {
Field siteConfig.scmIpSecurityRestrictionsDefaultAction | Must -Not -Be 'Allow' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Mission/AppSlotNetAccess_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw