{
   "properties": {
      "displayName": "Audit diagnostic setting",
      "policyType": "BuiltIn",
      "mode": "All",
      "description": "Audit diagnostic setting for selected resource types",
      "metadata": {
         "version": "1.0.0",
         "category": "Monitoring"
      },
      "parameters": {
         "listOfResourceTypes": {
            "type": "Array",
            "metadata": {
               "displayName": "Resource Types",
               "strongType": "resourceTypes"
            }
         }
      },
      "policyRule": {
         "if": {
            "field": "type",
            "in": "[parameters('listOfResourceTypes')]"
         },
         "then": {
            "effect": "AuditIfNotExists",
            "details": {
               "type": "Microsoft.Insights/diagnosticSettings",
               "existenceCondition": {
                  "allOf": [
                     {
                        "field": "Microsoft.Insights/diagnosticSettings/logs.enabled",
                        "equals": "true"
                     },
                     {
                        "field": "Microsoft.Insights/diagnosticSettings/metrics.enabled",
                        "equals": "true"
                     }
                  ]
               }
            }
         }
      }
   },
   "id": "/providers/Microsoft.Authorization/policyDefinitions/7f89b1eb-583c-429a-8828-af049802c1d9",
   "name": "7f89b1eb-583c-429a-8828-af049802c1d9"
}