{
    "properties": {
        "displayName": "Service Bus Topic must have Time to Live (TTL) of equal or less than 14 days",
        "policyType": "Custom",
        "mode": "All",
        "description": "This policy enables you to restrict services bus topic and subscriptions with TTL more than 2 weeks.",
        "metadata": {
            "category": "Effectory",
            "createdBy": null,
            "createdOn": null,
            "updatedBy": null,
            "updatedOn": null
        },
        "parameters": {
            "effect": {
                "type": "String",
                "metadata": {
                    "displayName": "Effect",
                    "description": "Enable or disable the execution of the policy"
                },
                "allowedValues": [
                    "audit",
                    "deny",
                    "disabled"
                  ],
                  "defaultValue": "audit"
            }
        },
        "policyRule": {
            "if": {
                "anyOf": [
                    {
                        "allOf": [
                            {
                                "field": "type",
                                "equals": "Microsoft.ServiceBus/namespaces/topics"
                            },
                            {
                                "field": "Microsoft.ServiceBus/namespaces/topics/defaultMessageTimeToLive",
                                "greater": "PW2"
                            }
                        ]
                    },
                    {
                        "allOf": [
                            {
                                "field": "type",
                                "equals": "Microsoft.ServiceBus/namespaces/topics/subscriptions"
                            },
                            {
                                "field": "Microsoft.ServiceBus/namespaces/topics/subscriptions/defaultMessageTimeToLive",
                                "greater": "PW2"
                            }
                        ]
                    }
                ]
            },
            "then": {
                "effect": "[parameters('effect')]"
            }
        }
    },
    "id": "/providers/Microsoft.Management/managementGroups/e9792fd7-4044-47e7-a40d-3fba46f1cd09/providers/Microsoft.Authorization/policyDefinitions/bab116a2-dffc-4740-9935-187dede2d2b0",
    "type": "Microsoft.Authorization/policyDefinitions",
    "name": "bab116a2-dffc-4740-9935-187dede2d2b0"
}