Gallery › App Service › Azure built-in policies
Function app slots should disable public network access
Converted Policy Audit Deny Disabled Mode Indexed Version 1.2.0
Disabling public network access improves security by ensuring that the Function app is not exposed on the public internet. Creating private endpoints can limit exposure of a Function App. 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 JSONFunctionApp_Slot_PublicNetworkAccess_Audit.json · 76 lines
{
"properties": {
"displayName": "Function app slots should disable public network access",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disabling public network access improves security by ensuring that the Function app is not exposed on the public internet. Creating private endpoints can limit exposure of a Function App. Learn more at: https://aka.ms/app-service-private-endpoint.",
"metadata": {
"version": "1.2.0",
"category": "App Service"
},
"version": "1.2.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"
},
{
"field": "Microsoft.Web/sites/slots/hostingEnvironmentProfile.id",
"exists": "false"
},
{
"field": "kind",
"contains": "functionapp"
},
{
"field": "kind",
"notContains": "workflowapp"
},
{
"field": "kind",
"notContains": "azurecontainerapps"
},
{
"anyOf": [
{
"field": "Microsoft.Web/sites/slots/publicNetworkAccess",
"exists": "false"
},
{
"field": "Microsoft.Web/sites/slots/publicNetworkAccess",
"notEquals": "Disabled"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.2.0",
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/11c82d0c-db9f-4d7b-97c5-f3f9aa957da2",
"name": "11c82d0c-db9f-4d7b-97c5-f3f9aa957da2"
}Bylaw11c82d0c-db9f-4d7b-97c5-f3f9aa957da2.bylaw.ps1 · 39 lines
# Converted from FunctionApp_Slot_PublicNetworkAccess_Audit.json by ConvertTo-Bylaw.
Policy '11c82d0c-db9f-4d7b-97c5-f3f9aa957da2' {
Properties @{
DisplayName = 'Function app slots should disable public network access'
Description = 'Disabling public network access improves security by ensuring that the Function app is not exposed on the public internet. Creating private endpoints can limit exposure of a Function App. Learn more at: https://aka.ms/app-service-private-endpoint.'
Version = '1.2.0'
Category = 'App Service'
PolicyVersion = '1.2.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 kind | Must -ContainText 'functionapp'
Field kind | Must -Not -ContainText 'workflowapp'
Field kind | Must -Not -ContainText 'azurecontainerapps'
}
Require 'publicNetworkAccess exists' {
Field publicNetworkAccess | Must -Exist
}
Require 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/App Service/FunctionApp_Slot_PublicNetworkAccess_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw