Gallery › App Service › Azure built-in policies
[Deprecated]: App Services should disable public network access
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-deprecated Deprecated
Disabling public network access improves security by ensuring that the App Service is not exposed on the public internet. Creating private endpoints can limit exposure of an App Service. 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 JSONPublicNetworkAccess_AINE.json · 50 lines
{
"properties": {
"displayName": "[Deprecated]: App Services should disable public network access",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disabling public network access improves security by ensuring that the App Service is not exposed on the public internet. Creating private endpoints can limit exposure of an App Service. Learn more at: https://aka.ms/app-service-private-endpoint.",
"metadata": {
"version": "1.0.0-deprecated",
"category": "App Service",
"deprecated": true
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Web/sites"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Web/sites/config",
"name": "web",
"existenceCondition": {
"field": "Microsoft.Web/sites/config/publicNetworkAccess",
"equals": "Disabled"
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/63a0ac64-5d5f-4569-8a3d-df67cc1ce9d7",
"name": "63a0ac64-5d5f-4569-8a3d-df67cc1ce9d7"
}Bylaw63a0ac64-5d5f-4569-8a3d-df67cc1ce9d7.bylaw.ps1 · 28 lines
# Converted from PublicNetworkAccess_AINE.json by ConvertTo-Bylaw.
Policy '63a0ac64-5d5f-4569-8a3d-df67cc1ce9d7' {
Properties @{
DisplayName = '[Deprecated]: App Services should disable public network access'
Description = 'Disabling public network access improves security by ensuring that the App Service is not exposed on the public internet. Creating private endpoints can limit exposure of an App Service. Learn more at: https://aka.ms/app-service-private-endpoint.'
Version = '1.0.0-deprecated'
Category = 'App Service'
Deprecated = $true
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites'
AuditIfNotExists 'Microsoft.Web/sites/config' -Name 'web' -Effect (Param Effect) {
Require 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
}Source: built-in-policies/policyDefinitions/App Service/PublicNetworkAccess_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw