The honesty about VPNs is appreciated, because that's where this query lives or dies. One way to do the tuning without hand-maintaining egress ranges: classify the IPs instead of the users.
Add IPAddress to the projection and PrevIP = prev(IPAddress), then join both ends of each pair against a lookup table with columns like is_vpn, vpn_provider, is_corporate_gateway and is_cloud. The decision gets more specific than a global exclusion:
either side is your own VPN or a known corporate gateway → suppress
either side is a commercial VPN → keep, lower severity, show the provider name in the alert
either side is a cloud/hosting IP → raise severity, since people rarely sign in to Entra from a VPS on purpose
The table can be a watchlist refreshed daily from whatever IP intelligence you have. We produce this kind of data at IPGeolocation.io (I work there): the security endpoint returns those flags plus vpn_last_seen, and bulk takes up to 50,000 IPs per call, enough for a day of distinct sign-in IPs in most tenants. It's paid, so if budget is tight, start with your own egress list and named locations.
One catch either way: label the IP when the sign-in happens, not when the analyst opens the incident. VPN exits get reassigned, and next month's classification can be wrong for this week.
Thanks, that's a really good refinement. Classifying both ends of the pair rather than excluding users keeps the detection useful on VPN-heavy tenants, and putting the provider name in the alert makes triage much quicker. I should fold this into a future follow-up post.
Glad it was useful, Alan, and looking forward to the follow-up post. If you end up trying the IPGeolocation.io security endpoint for the watchlist, feel free to reach out. I'd be happy to help with the setup or the KQL join.
Furqan Ashraf
The honesty about VPNs is appreciated, because that's where this query lives or dies. One way to do the tuning without hand-maintaining egress ranges: classify the IPs instead of the users.
Add
IPAddressto the projection andPrevIP = prev(IPAddress), then join both ends of each pair against a lookup table with columns likeis_vpn,vpn_provider,is_corporate_gatewayandis_cloud. The decision gets more specific than a global exclusion:The table can be a watchlist refreshed daily from whatever IP intelligence you have. We produce this kind of data at IPGeolocation.io (I work there): the security endpoint returns those flags plus
vpn_last_seen, and bulk takes up to 50,000 IPs per call, enough for a day of distinct sign-in IPs in most tenants. It's paid, so if budget is tight, start with your own egress list and named locations.One catch either way: label the IP when the sign-in happens, not when the analyst opens the incident. VPN exits get reassigned, and next month's classification can be wrong for this week.