{
  "properties": {
    "displayName": "Service Fabric clusters should have the ClusterProtectionLevel property set to EncryptAndSign",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Service Fabric provides three levels of protection (None, Sign and EncryptAndSign) for node-to-node communication using a primary cluster certificate. Set the protection level to ensure that all node-to-node messages are encrypted and digitally signed",
    "metadata": {
      "version": "1.1.0",
      "category": "Service Fabric"
    },
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "The effect determines what happens when the policy rule is evaluated to match"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ServiceFabric/clusters"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.ServiceFabric/clusters/fabricSettings[*].name",
                "notEquals": "Security"
              },
              {
                "field": "Microsoft.ServiceFabric/clusters/fabricSettings[*].parameters[*].name",
                "notEquals": "ClusterProtectionLevel"
              },
              {
                "field": "Microsoft.ServiceFabric/clusters/fabricSettings[*].parameters[*].value",
                "notEquals": "EncryptAndSign"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/617c02be-7f02-4efd-8836-3180d47b6c68",
  "name": "617c02be-7f02-4efd-8836-3180d47b6c68"
}