{
   "properties": {
      "displayName": "Audit transparent data encryption status",
      "description": "Audit transparent data encryption status for SQL databases",
      "mode": "Indexed",
      "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.Sql/servers/databases"
               },
               {
                  "field": "name",
                  "notEquals": "master"
               }
            ]
         },
         "then": {
            "effect": "[parameters('effect')]",
            "details": {
               "type": "Microsoft.Sql/servers/databases/transparentDataEncryption",
               "name": "current",
               "existenceCondition": {
                  "allOf": [
                     {
                        "field": "Microsoft.Sql/transparentDataEncryption.status",
                        "equals": "enabled"
                     }
                  ]
               }
            }
         }
      }
   }
}