This template creates a Front Door Standard/Premium including a web application firewall with a custom rule.

{"type": "microsoft.cdn/profiles", "apiversion": "2021-06-01", "name": "[variables('profilename')]", "location": "global", "sku": {"name": "[parameters('frontdoorskuname')]"}}{"type": "microsoft.cdn/profiles/afdendpoints", "apiversion": "2021-06-01", "name": "[format('{0}/{1}", variables('profilename'), parameters('endpointname'))]", "location": "global", "properties": {"enabledstate": "enabled"}, "dependson": ["[resourceid('microsoft.cdn/profiles", variables('profilename'))]"]}{"type": "microsoft.cdn/profiles/origingroups", "apiversion": "2021-06-01", "name": "[format('{0}/{1}", variables('profilename'), variables('origingroupname'))]", "properties": {"loadbalancingsettings": {"samplesize": 4, "successfulsamplesrequired": 3}, "healthprobesettings": {"probepath": "/", "proberequesttype": "head", "probeprotocol": "http", "probeintervalinseconds": 100}}, "dependson": ["[resourceid('microsoft.cdn/profiles", variables('profilename'))]"]}{"type": "microsoft.cdn/profiles/origingroups/origins", "apiversion": "2021-06-01", "name": "[format('{0}/{1}/{2}", variables('profilename'), variables('origingroupname'), variables('originname'))]", "properties": {"hostname": "[parameters('originhostname')]", "httpport": 80, "httpsport": 443, "originhostheader": "[parameters('originhostname')]", "priority": 1, "weight": 1000}, "dependson": ["[resourceid('microsoft.cdn/profiles/origingroups", variables('profilename'), variables('origingroupname'))]", "[resourceid('microsoft.cdn/profiles", variables('profilename'))]"]}{"type": "microsoft.cdn/profiles/afdendpoints/routes", "apiversion": "2021-06-01", "name": "[format('{0}/{1}/{2}", variables('profilename'), parameters('endpointname'), variables('routename'))]", "properties": {"origingroup": {"id": "[resourceid('microsoft.cdn/profiles/origingroups", variables('profilename'), variables('origingroupname'))]"}, "supportedprotocols": ["http", "https"], "patternstomatch": ["/*"], "forwardingprotocol": "httpsonly", "linktodefaultdomain": "enabled", "httpsredirect": "enabled"}, "dependson": ["[resourceid('microsoft.cdn/profiles/afdendpoints", variables('profilename'), parameters('endpointname'))]", "[resourceid('microsoft.cdn/profiles/origingroups/origins", variables('profilename'), variables('origingroupname'), variables('originname'))]", "[resourceid('microsoft.cdn/profiles/origingroups", variables('profilename'), variables('origingroupname'))]", "[resourceid('microsoft.cdn/profiles", variables('profilename'))]"]}{"type": "microsoft.cdn/profiles/securitypolicies", "apiversion": "2021-06-01", "name": "[format('{0}/{1}", variables('profilename'), variables('securitypolicyname'))]", "properties": {"parameters": {"type": "webapplicationfirewall", "wafpolicy": {"id": "[resourceid('microsoft.network/frontdoorwebapplicationfirewallpolicies", variables('wafpolicyname'))]"}, "associations": [{"domains": [{"id": "[resourceid('microsoft.cdn/profiles/afdendpoints", variables('profilename'), parameters('endpointname'))]"}], "patternstomatch": ["/*"]}]}}, "dependson": ["[resourceid('microsoft.cdn/profiles/afdendpoints", variables('profilename'), parameters('endpointname'))]", "[resourceid('microsoft.cdn/profiles", variables('profilename'))]", "[resourceid('microsoft.network/frontdoorwebapplicationfirewallpolicies", variables('wafpolicyname'))]"]}