{
  "properties": {
    "displayName": "Service Bus Premium namespaces should use a customer-managed key for encryption",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Azure Service Bus supports the option of encrypting data at rest with either Microsoft-managed keys (default) or customer-managed keys. Choosing to encrypt data using customer-managed keys enables you to assign, rotate, disable, and revoke access to the keys that Service Bus will use to encrypt data in your namespace. Note that Service Bus only supports encryption with customer-managed keys for premium namespaces.",
    "metadata": {
      "version": "1.0.0",
	  "category": "Service Bus"
    },
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
		  {
            "field": "type",
            "equals": "Microsoft.ServiceBus/namespaces"
          },
		  {
            "field": "Microsoft.ServiceBus/namespaces/sku.tier",
            "equals": "Premium"
          },
          {
            "not": {
              "field": "Microsoft.ServiceBus/namespaces/encryption.keySource",
              "equals": "Microsoft.Keyvault"
            }
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/295fc8b1-dc9f-4f53-9c61-3f313ceab40a",
  "name": "295fc8b1-dc9f-4f53-9c61-3f313ceab40a"
}