private static CustomRule CreateCountryRateLimitRule()

in Azure WAF/Alert - Process Azure FrontDoor Alerts/ProcessAFDAlerts.cs [269:285]


        private static CustomRule CreateCountryRateLimitRule(AlertInfo alertInfo)
        {
            var alertCountryCode = GetCountryCode(alertInfo.Country);

            return new CustomRule(
                GetCountryRateLimitPriority(alertCountryCode),
                RuleType.RateLimitRule,
                new List<MatchCondition>
                {
                    new MatchCondition("RemoteAddr", "GeoMatch", new List<string> { alertCountryCode })
                },
                "Block")
            {
                Name = $"{alertCountryCode}{MitigateDDOSRateLimitCountryRuleNamePostfix}",
                RateLimitDurationInMinutes = 5
            };
        }