Gallery › App Service › Azure built-in policies
[Deprecated]: Diagnostic logs in App Services should be enabled
Converted Policy AuditIfNotExists Disabled Mode All Version 2.0.0-deprecated Deprecated
Audit enabling of diagnostic logs on the app. This enables you to recreate activity trails for investigation purposes if a security incident occurs or your network is compromised
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAuditLoggingMonitoring_Audit_v2_deprecated.json · 73 lines
{
"properties": {
"displayName": "[Deprecated]: Diagnostic logs in App Services should be enabled",
"policyType": "BuiltIn",
"mode": "All",
"description": "Audit enabling of diagnostic logs on the app. This enables you to recreate activity trails for investigation purposes if a security incident occurs or your network is compromised",
"metadata": {
"version": "2.0.0-deprecated",
"category": "App Service",
"deprecated": true
},
"version": "2.0.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",
"notContains": "functionapp"
},
{
"field": "kind",
"notContains": "linux"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Web/sites/config",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Web/sites/config/detailedErrorLoggingEnabled",
"equals": "true"
},
{
"field": "Microsoft.Web/sites/config/httpLoggingEnabled",
"equals": "true"
},
{
"field": "Microsoft.Web/sites/config/requestTracingEnabled",
"equals": "true"
}
]
}
}
}
},
"versions": [
"2.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b607c5de-e7d9-4eee-9e5c-83f1bcee4fa0",
"name": "b607c5de-e7d9-4eee-9e5c-83f1bcee4fa0"
}Bylawb607c5de-e7d9-4eee-9e5c-83f1bcee4fa0.bylaw.ps1 · 40 lines
# Converted from AuditLoggingMonitoring_Audit_v2_deprecated.json by ConvertTo-Bylaw.
Policy 'b607c5de-e7d9-4eee-9e5c-83f1bcee4fa0' {
Properties @{
DisplayName = '[Deprecated]: Diagnostic logs in App Services should be enabled'
Description = 'Audit enabling of diagnostic logs on the app. This enables you to recreate activity trails for investigation purposes if a security incident occurs or your network is compromised'
Version = '2.0.0-deprecated'
Category = 'App Service'
Deprecated = $true
PolicyVersion = '2.0.0'
Mode = 'All'
}
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 -Not -ContainText 'functionapp'
}
Require 'kind contains linux' {
Field kind | Must -ContainText 'linux'
}
}
AuditIfNotExists 'Microsoft.Web/sites/config' -Effect (Param Effect) {
Require 'detailedErrorLoggingEnabled is true, httpLoggingEnabled is true and requestTracingEnabled is true' {
Field detailedErrorLoggingEnabled | Must -Be 'true'
Field httpLoggingEnabled | Must -Be 'true'
Field requestTracingEnabled | Must -Be 'true'
}
}
}Source: built-in-policies/policyDefinitions/App Service/AuditLoggingMonitoring_Audit_v2_deprecated.json in Azure/azure-policy, under the MIT licence.
Bylaw