Gallery › Mission › Azure built-in policies
App Service apps 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 so that it is not accessible over the public internet. This can reduce data leakage risks. Learn more at: https://aka.ms/app-service-private-endpoint.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAppNetAccess_Audit.json · 66 lines
{
"properties": {
"displayName": "App Service apps 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 so that it is not accessible over the public internet. This can reduce data leakage risks. Learn more at: https://aka.ms/app-service-private-endpoint.",
"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"
},
{
"exists": "false",
"field": "Microsoft.Web/sites/hostingEnvironmentProfile.id"
},
{
"field": "Microsoft.Web/sites/publicNetworkAccess",
"equals": "Enabled"
},
{
"anyOf": [
{
"field": "Microsoft.Web/sites/siteConfig.ipSecurityRestrictionsDefaultAction",
"equals": "Allow"
},
{
"field": "Microsoft.Web/sites/siteConfig.scmIpSecurityRestrictionsDefaultAction",
"equals": "Allow"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b0779e02-7159-4057-bcbf-bd6132847d2b",
"name": "b0779e02-7159-4057-bcbf-bd6132847d2b"
}Bylawb0779e02-7159-4057-bcbf-bd6132847d2b.bylaw.ps1 · 37 lines
# Converted from AppNetAccess_Audit.json by ConvertTo-Bylaw.
Policy 'b0779e02-7159-4057-bcbf-bd6132847d2b' {
Properties @{
DisplayName = 'App Service apps 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 so that it is not accessible over the public internet. This can reduce data leakage risks. Learn more at: https://aka.ms/app-service-private-endpoint.'
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' {
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/AppNetAccess_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw