Gallery › App Service › Azure built-in policies
App Service app slots should have remote debugging turned off
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.1
Remote debugging requires inbound ports to be opened on an App Service app. 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_WebApp_Slot_Audit.json · 56 lines
{
"properties": {
"displayName": "App Service app slots should have remote debugging turned off",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Remote debugging requires inbound ports to be opened on an App Service app. Remote debugging should be turned off.",
"metadata": {
"version": "1.0.1",
"category": "App Service"
},
"version": "1.0.1",
"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/slots"
},
{
"field": "kind",
"notContains": "functionapp"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Web/sites/slots/config",
"existenceCondition": {
"field": "Microsoft.Web/sites/slots/config/web.remoteDebuggingEnabled",
"equals": "false"
}
}
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a08ae1ab-8d1d-422b-a123-df82b307ba61",
"name": "a08ae1ab-8d1d-422b-a123-df82b307ba61"
}Bylawa08ae1ab-8d1d-422b-a123-df82b307ba61.bylaw.ps1 · 33 lines
# Converted from DisableRemoteDebugging_WebApp_Slot_Audit.json by ConvertTo-Bylaw.
Policy 'a08ae1ab-8d1d-422b-a123-df82b307ba61' {
Properties @{
DisplayName = 'App Service app slots should have remote debugging turned off'
Description = 'Remote debugging requires inbound ports to be opened on an App Service app. Remote debugging should be turned off.'
Version = '1.0.1'
Category = 'App Service'
PolicyVersion = '1.0.1'
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/slots' {
Require 'kind contains functionapp' {
Field kind | Must -ContainText 'functionapp'
}
}
AuditIfNotExists 'Microsoft.Web/sites/slots/config' -Effect (Param Effect) {
Require 'web.remoteDebuggingEnabled is false' {
Field web.remoteDebuggingEnabled | Must -Be 'false'
}
}
}Source: built-in-policies/policyDefinitions/App Service/DisableRemoteDebugging_WebApp_Slot_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw