{
  "properties": {
    "displayName": "Event Hub firewall should only allow certain IPs",
    "description": "This policy allows only restricted IPs for Event hub firewall",
    "mode": "All",
    "parameters": {
      "allowedIps": {
        "type": "Array",
        "metadata": {
          "displayName": "Allow IPs for event hub firewall",
          "description": "List of IPs allowed for event hub firewall"
        },
        "defaultValue": []
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.EventHub/namespaces/networkRuleSets"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.EventHub/namespaces/networkRuleSets/default.defaultAction",
                "equals": "Allow"
              },
              {
                "not": {
                  "field": "Microsoft.EventHub/namespaces/networkRuleSets/default.ipRules[*].ipMask",
                  "in": "[parameters('allowedIps')]"
                }
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "deny"
      }
    }
  }
}