Gallery › App Service › Azure built-in policies
Function apps should have remote debugging turned off
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 2.1.0
Remote debugging requires inbound ports to be opened on Function apps. Remote debugging should be turned off.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDisableRemoteDebugging_FunctionApp_Audit.json · 65 lines
{
"properties": {
"displayName": "Function apps should have remote debugging turned off",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Remote debugging requires inbound ports to be opened on Function apps. Remote debugging should be turned off.",
"metadata": {
"version": "2.1.0",
"category": "App Service"
},
"version": "2.1.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites"
},
{
"field": "kind",
"contains": "functionapp"
},
{
"field": "kind",
"notContains": "workflowapp"
},
{
"field": "kind",
"notContains": "azurecontainerapps"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Web/sites/config",
"existenceCondition": {
"field": "Microsoft.Web/sites/config/web.remoteDebuggingEnabled",
"equals": "false"
}
}
}
},
"versions": [
"2.1.0",
"2.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0e60b895-3786-45da-8377-9c6b4b6ac5f9",
"name": "0e60b895-3786-45da-8377-9c6b4b6ac5f9"
}Bylaw0e60b895-3786-45da-8377-9c6b4b6ac5f9.bylaw.ps1 · 38 lines
# Converted from DisableRemoteDebugging_FunctionApp_Audit.json by ConvertTo-Bylaw.
Policy '0e60b895-3786-45da-8377-9c6b4b6ac5f9' {
Properties @{
DisplayName = 'Function apps should have remote debugging turned off'
Description = 'Remote debugging requires inbound ports to be opened on Function apps. Remote debugging should be turned off.'
Version = '2.1.0'
Category = 'App Service'
PolicyVersion = '2.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites' {
When {
Field kind | Must -ContainText 'functionapp'
Field kind | Must -Not -ContainText 'workflowapp'
}
Require 'kind contains azurecontainerapps' {
Field kind | Must -ContainText 'azurecontainerapps'
}
}
AuditIfNotExists 'Microsoft.Web/sites/config' -Effect (Param Effect) {
Require 'web.remoteDebuggingEnabled is false' {
Field web.remoteDebuggingEnabled | Must -Be 'false'
}
}
}Source: built-in-policies/policyDefinitions/App Service/DisableRemoteDebugging_FunctionApp_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw