{
    "if": {
      "field": "type",
      "equals": "Microsoft.KeyVault/vaults"
    },
    "then": {
      "effect": "AuditIfNotExists",
      "details":{
        "type": "Microsoft.Insights/diagnosticSettings",
        "existenceCondition": {
          "allOf": [
            {
              "field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.enabled",
              "equals": "true"
            },
            {
              "field": "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.days",
              "equals": "[parameters('requiredRetentionDays')]"
            }
          ]
        }
      }
    }
}
