{
  "properties": {
    "displayName": "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",
      "category": "App Service"
    },
    "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"
              }
            ]
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/b607c5de-e7d9-4eee-9e5c-83f1bcee4fa0",
  "name": "b607c5de-e7d9-4eee-9e5c-83f1bcee4fa0"
}