Alright class.
First threat intelligence lesson. This rule reads the new ThreatIntelIndicators table, the STIX-shaped replacement for the old ThreatIntelligenceIndicator, and maps IP indicators against sign-ins. If your tenant has moved to the new table and your copy of the TI map rules still reads the old one, it has been quietly returning nothing, so this is worth your attention twice over. The premise is the oldest one in the SOC: someone signed in from an address we know is bad. The execution alerts on the wrong half of the internet.
A Match Is Not an Incident
The query extracts the sign-in outcome and then never looks at it:
| extend StatusCode = tostring(Status.errorCode), StatusDetails = tostring(Status.additionalDetails), StatusReason = tostring(Status.failureReason)
Those three columns ride to the output as decoration. Nothing gates on them, so a failed password attempt from a listed IP produces the same alert as a successful session from one. Now think about the base rate. TI feeds are full of Tor exits, scanner infrastructure and botnet addresses, and those addresses spray every tenant on the internet, every day, and fail. A blocked spray from known-bad infrastructure is internet weather; it tells you your front door works. The event that deserves an analyst is the success, and this rule cannot tell the two apart.
Three Bugs in One Join
The indicator value is uppercased, then joined case-sensitively:
| extend NetworkSourceIP = toupper(ObservableValue)
...
| join kind=innerunique (Signins) on $left.TI_ipEntity == $right.IPAddress
IPv4 survives because digits have no case. IPv6 does not: sign-in logs carry lowercase hex, the indicator is now uppercase, and == is case-sensitive, so every IPv6 indicator the type filter deliberately includes can never match anything.
The validity logic argues with itself. One line keeps indicators with no expiry, treating an empty ValidUntil as still valid. Two joins later, where SigninLogs_TimeGenerated < ValidUntil compares against that empty value, which is false, and drops every one of them. Kept as active, then discarded for being active indefinitely.
And the new schema ships a Revoked column that the query never reads, while the Url extend runs after the type filter has already excluded url indicators, so it ships permanently empty.
What TI Plus Identity Actually Buys
Marry the indicator to the sign-in outcome and the account, and three shapes fall out.
Spray, then success. The same listed address fails against a dozen accounts and then lands one. That success amid its own failure backdrop is the classic credential attack ending, and the failures are what make the success loud.
Success without a second factor. An interactive sign-in from listed infrastructure that only had to present a password is the compromise in progress, whatever the feed's confidence says.
Success that is only tokens. No interactive sign-in at all, just non-interactive successes from the listed address, is the shape of a replayed or stolen token being spent.
Add who the account is, because a privileged user succeeding from listed infrastructure is a different conversation from a contractor on a VPN. All of it sits in the sign-in row, the indicator row, or one identity lookup away.
Internet Weather Is Not Your Incident Queue
Two benign floods own this telemetry. The first is the failure noise above, and the rebuild removes it structurally: failed attempts from listed IPs are context columns on the row, never candidates. The second is your own people. Commercial VPN and Tor egress addresses live in feeds, corporate egress occasionally lands on low-grade lists, and every employee behind one becomes a TI match. Under the score, an MFA-protected, low-risk success by an ordinary account from a low-confidence indicator lands at zero and stays silent.
The stated trade-off: an MFA-protected success from a high-confidence indicator scores one and also stays silent unless something stacks. If your feeds are curated enough that you want those alone, raise the confidence weight to two; the tuning note says exactly that.
The Rebuild
The gate is the success, then the score:
| where IsSuccess
...
| where RiskScore >= FireThreshold
Single-factor success fires alone. Sign-in risk, a privileged account, or a spray backdrop each fire with any second signal. Degradation is graceful: without P2 the risk and role signals stay silent and the structural ones carry the rule, and a missing lookup silences a signal rather than inventing one. The membership set for the pre-filter is built with an explicit one-million cap, and indicators without an expiry stay valid all the way to the output this time.
What the Analyst Sees
The row is the triage. The indicator side: descriptions, sources, confidence, activity groups and expiry, so the analyst knows which feed said what without opening the TI blade. The attack side: FailedCount and TargetedUsers show whether this address was spraying the tenant around its success. The account side: roles, department and user type from UEBA. The session side: apps, country, and the single-factor and non-interactive counts that say how the door was opened.
The RiskIndicators Field
Same accumulating string as the rest of the series, mapped as a custom detail:
SingleFactorSuccess | HighRiskSignIn | PrivilegedAccount | SprayBackdrop | HighConfidenceIoc | NonInteractiveOnly | OffHoursActivity
The combination to chase is SingleFactorSuccess with SprayBackdrop: a password-only success from an address that was failing against your other accounts in the same hour. That is spray-to-compromise caught at the moment it worked.
The Blind Spots You Should Know About
Failure-only activity from listed IPs never fires here by design; a spray detection owns that axis, and this rule hands it off rather than duplicating it.
Indicators expressed as ranges do not equal a single address, so a CIDR-shaped network-traffic indicator will not match; expand ranges upstream or accept the gap.
This rule is IPs only. URL, domain and hash indicators are sibling rules against other tables, not extra weight here. And a token replay that arrives carrying an MFA claim scores low unless risk, privilege or spray stack on top; that is the honest limit of what a sign-in row can prove.
MITRE Mappings for the Updated Rule
Tactic: Initial Access.
T1078.004 Valid Accounts, Cloud Accounts. The gate is a successful authentication with working credentials from adversary infrastructure, which is this technique to the letter.
Rule Settings
Run every 60 minutes, with the query period at 14 days so the indicator and identity lookups resolve. High severity: a firing row is a successful sign-in from listed infrastructure with at least one aggravating factor. Alert per result; the query collapses to one row per account and IP. Group by the IP entity over 8 hours, because one address landing several accounts is one campaign and should be one incident.
Entity mapping:
Name to Account (Name), UPNSuffix to Account (UPNSuffix)
IPAddress to IP (Address)
Custom details: RiskScore, RiskIndicators, MaxConfidence, TiSources, TiDescriptions, ActivityGroups, TiIds, LatestValidUntil, SuccessCount, SingleFactorCnt, RiskySuccesses, FailedCount, TargetedUsers, Apps, Country, UserRoles, Department, UserType.
KQL
// =====================================================================
// TI Mapped IP - Successful Sign-in
// =====================================================================
// Description : Fires when an account successfully signs in from an IP listed in threat
// intelligence, scored by what makes the success dangerous: single-factor
// authentication, Entra sign-in risk, a privileged account, a spray backdrop
// from the same address, indicator confidence and token-replay shape. Failed
// attempts from listed IPs are context columns, never candidates, because a
// blocked spray from known-bad infrastructure is internet weather. Indicator
// values are lowercased so IPv6 matches work, and revoked or expired
// indicators are honoured.
// Type : Detection
//
// Tables : SigninLogs, AADNonInteractiveUserSignInLogs, ThreatIntelIndicators, IdentityInfo
// Connectors : Microsoft Entra ID (SignInLogs, NonInteractiveUserSignInLogs),
// Threat Intelligence (ThreatIntelIndicators), Microsoft Sentinel UEBA (IdentityInfo)
// License : Microsoft Sentinel; Microsoft Entra ID P1 (sign-in logs),
// P2 recommended (sign-in risk, UEBA); without P2 those two signals stay silent
//
// Tuning : - Set the rule query period to P14D; the 14d indicator and identity lookups only resolve then
// - ConfidenceFloor - indicator confidence that counts as high; align to your feeds
// - SprayFloor - distinct accounts failed against from one IP that count as a spray backdrop
// - SensitiveRoles - the roles that make a signed-in account privileged
// - BusinessStart / BusinessEnd - local working hours; TimeGenerated is UTC, shift to your tenant
// - If your feeds are curated and you want MFA-protected successes from high-confidence
// indicators to fire alone, raise W_HighConfidence to 2
//
// Known FPs : - Staff on commercial VPNs or Tor whose egress IP sits in a feed: an MFA-protected,
// low-risk success scores below threshold and stays silent
// - Corporate egress IPs recycled onto low-grade lists: same handling; check TiSources
// in the row and clean the feed rather than the rule
// - A pentest or red team signing in single-factor from flagged infrastructure fires,
// as it should
//
// Author : Bartosz Wysocki | https://www.itprofessor.cloud
// Version : 1.0 | 2026-07-04
// =====================================================================
let DetectionWindow = 1h;
let TiLookback = 14d; // indicator ingestion window; the rule query period must match
let IdentityLookback = 14d; // full UEBA sync cycle, for roles and department
let ConfidenceFloor = 75; // indicator confidence that counts as high
let SprayFloor = 5; // distinct accounts failed against from one IP in the window
let BusinessStart = 7;
let BusinessEnd = 19;
let FireThreshold = 2;
// Scoring weights - the success is the gate; these decide whether it is worth an analyst
let W_NoMfa = 3; // interactive success that satisfied only a single factor
let W_HighRisk = 2; // Entra scored the successful sign-in medium or high
let W_Privileged = 2; // the account holds a sensitive directory role
let W_SprayBackdrop = 2; // the same IP also failed against several other accounts
let W_HighConfidence = 1; // indicator confidence at or above ConfidenceFloor
let W_NonInteractiveOnly = 1; // success arrived only through non-interactive flows; token-replay shape
let W_OffHours = 1; // activity outside working hours
let SensitiveRoles = dynamic([
"Global Administrator", "Privileged Role Administrator", "Privileged Authentication Administrator",
"Security Administrator", "User Administrator", "Application Administrator",
"Cloud Application Administrator", "Hybrid Identity Administrator",
"Exchange Administrator", "SharePoint Administrator", "Intune Administrator"
]);
// Sign-ins in the window, both flavours, IPs lowercased so IPv6 can ever match an indicator
let WindowSignins = materialize(union isfuzzy=true
(SigninLogs
| where TimeGenerated > ago(DetectionWindow)
| extend IsInteractive = true),
(AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(DetectionWindow)
| extend Status = todynamic(Status), LocationDetails = todynamic(LocationDetails)
| extend IsInteractive = false)
| extend IPAddress = tolower(IPAddress)
| extend UserPrincipalName = tolower(UserPrincipalName)
| extend IsSuccess = tostring(ResultType) == "0"
| extend AuthReq = tostring(AuthenticationRequirement)
| extend IsRisky = tostring(RiskLevelDuringSignIn) in ("high", "medium")
| extend Country = tostring(LocationDetails.countryOrRegion)
| extend HourOfDay = datetime_part("Hour", TimeGenerated)
| extend OffHoursEvent = HourOfDay < BusinessStart or HourOfDay >= BusinessEnd or dayofweek(TimeGenerated) in (0d, 6d)
);
let SigninIpSet = toscalar(WindowSignins | summarize make_set(IPAddress, 1000000));
// Active, unrevoked, unexpired IP indicators seen against the window's IPs, one row per IP.
// Lowercase both sides; indicators without an expiry stay valid instead of being dropped
let TI = ThreatIntelIndicators
| where TimeGenerated > ago(TiLookback)
| extend IndicatorType = replace(@"\[|\]|\""", "", tostring(split(ObservableKey, ":", 0)))
| where IndicatorType in ("ipv4-addr", "ipv6-addr", "network-traffic")
| extend TiIp = tolower(trim(" ", ObservableValue))
| where TiIp in (SigninIpSet)
| summarize arg_max(TimeGenerated, *) by Id, ObservableValue
| where IsActive == true and Revoked != true
| where isnull(ValidUntil) or ValidUntil > now()
| extend Description = tostring(parse_json(Data).description)
| where Description !contains_cs "State: inactive;" and Description !contains_cs "State: falsepos;"
| extend ActivityGroup = extract(@"ActivityGroup:(\S+)", 1, tostring(parse_json(Data).labels))
| summarize
MaxConfidence = max(Confidence),
TiSources = make_set(SourceSystem, 10),
TiDescriptions = make_set(Description, 5),
ActivityGroups = make_set_if(ActivityGroup, isnotempty(ActivityGroup), 5),
TiIds = make_set(Id, 10),
LatestValidUntil = max(ValidUntil)
by TiIp;
// Per-IP failure context: who else this address went after in the same window
let IpContext = WindowSignins
| summarize FailedCount = countif(IsSuccess == false),
TargetedUsers = dcountif(UserPrincipalName, IsSuccess == false)
by IPAddress;
// Account context for the signed-in user
let IdentityContext = IdentityInfo
| where TimeGenerated > ago(IdentityLookback)
| summarize arg_max(TimeGenerated, AssignedRoles, Department, UserType) by AccountUPN = tolower(AccountUPN);
// Successful sign-ins from listed IPs, one row per account and IP, scored
WindowSignins
| where IsSuccess
| summarize
StartTime = min(TimeGenerated),
EndTime = max(TimeGenerated),
SuccessCount = count(),
InteractiveSuccess = countif(IsInteractive),
SingleFactorCnt = countif(IsInteractive and AuthReq =~ "singleFactorAuthentication"),
RiskySuccesses = countif(IsRisky),
Apps = make_set(AppDisplayName, 10),
Country = take_any(Country),
OffHoursCount = countif(OffHoursEvent)
by UserPrincipalName, IPAddress
| join kind=inner TI on $left.IPAddress == $right.TiIp
| join kind=leftouter IpContext on IPAddress
| join kind=leftouter IdentityContext on $left.UserPrincipalName == $right.AccountUPN
| extend UserRoles = tostring(AssignedRoles)
| extend sNoMfa = SingleFactorCnt > 0
| extend sHighRisk = RiskySuccesses > 0
| extend sPrivileged = UserRoles has_any (SensitiveRoles)
| extend sSpray = TargetedUsers >= SprayFloor
| extend sHighConf = MaxConfidence >= ConfidenceFloor
| extend sNonInteractive = InteractiveSuccess == 0
| extend sOffHours = OffHoursCount > 0
| extend RiskScore =
iff(sNoMfa, W_NoMfa, 0)
+ iff(sHighRisk, W_HighRisk, 0)
+ iff(sPrivileged, W_Privileged, 0)
+ iff(sSpray, W_SprayBackdrop, 0)
+ iff(sHighConf, W_HighConfidence, 0)
+ iff(sNonInteractive, W_NonInteractiveOnly, 0)
+ iff(sOffHours, W_OffHours, 0)
| where RiskScore >= FireThreshold
| extend Name = tostring(split(UserPrincipalName, "@", 0)[0]), UPNSuffix = tostring(split(UserPrincipalName, "@", 1)[0])
| extend Risk_1 = iff(sNoMfa, "SingleFactorSuccess", "")
| extend Risk_2 = iff(sHighRisk, "HighRiskSignIn", "")
| extend Risk_3 = iff(sPrivileged, "PrivilegedAccount", "")
| extend Risk_4 = iff(sSpray, "SprayBackdrop", "")
| extend Risk_5 = iff(sHighConf, "HighConfidenceIoc", "")
| extend Risk_6 = iff(sNonInteractive, "NonInteractiveOnly", "")
| extend Risk_7 = iff(sOffHours, "OffHoursActivity", "")
| extend RiskIndicators = trim(@"\s\|\s*$", strcat(
iff(isnotempty(Risk_1), strcat(Risk_1, " | "), ""),
iff(isnotempty(Risk_2), strcat(Risk_2, " | "), ""),
iff(isnotempty(Risk_3), strcat(Risk_3, " | "), ""),
iff(isnotempty(Risk_4), strcat(Risk_4, " | "), ""),
iff(isnotempty(Risk_5), strcat(Risk_5, " | "), ""),
iff(isnotempty(Risk_6), strcat(Risk_6, " | "), ""),
iff(isnotempty(Risk_7), strcat(Risk_7, " | "), "")
))
| project
StartTime, EndTime, RiskScore, RiskIndicators,
UserPrincipalName, Name, UPNSuffix, IPAddress, Country,
SuccessCount, InteractiveSuccess, SingleFactorCnt, RiskySuccesses,
FailedCount, TargetedUsers, Apps,
MaxConfidence, TiSources, TiDescriptions, ActivityGroups, TiIds, LatestValidUntil,
UserRoles, Department, UserType, OffHoursCount
| sort by RiskScore desc, EndTime desc
You can also download this as an analytic rule and import it directly to Sentinel.
Follow my repo - GitHub
What You Should Do Next
Confirm your TI is landing in ThreatIntelIndicators first, because that decides whether any TI rule sees anything. Query the table for the last day; if it is empty and the old table is not, your connectors have not migrated and every new-table rule is decorative.
Run it over the last day next to the original. The original returns every match, mostly failures; this should return close to nothing, with the failure activity still visible as context on any row that does fire.
Look at your feeds through the TiSources column. If low-grade lists keep putting your VPN egress in the results, the fix is feed hygiene or the confidence floor, not an IP allowlist.
Build the siblings. URL and domain indicators against web and DNS telemetry deserve the same treatment this rule gives IPs, and the failure side belongs to your spray detection.
Class dismissed.