Microsoft Secure Tech Accelerator
Apr 03 2024, 07:00 AM - 11:00 AM (PDT)
Microsoft Tech Community
SOLVED

Log-Analytics query doesn't show results with join operator

Copper Contributor

Hi all,

 

I need help with a query, which will be used for a (Sentinel) analytics rule. The purpose of this alert rule is to check for logons to disabled accounts in the last day and only show results when that account was disabled >30 days ago.

 

This is what I've made so far:

let DisabledAccount = SecurityEvent
| where EventID == "4725" // EventID 4725 = User disabled in AD
| where TimeGenerated > ago(30d) // Disabling of account should be more than 30 days ago.
| where SubjectUserName !endswith "$" and TargetUserName !endswith "$" // Filter out share accounts.
| project DisabledOnDate = TimeGenerated, TargetUserName, UserDisabledBy = SubjectUserName ;
let LogonWithDisabledAccount = SecurityEvent
| where TimeGenerated > ago(1d) // Logon with disabled account should be in the last 1 day.
| where EventID == "4768" and Status contains "0x12" // EventID 4768 = logon on disabled account
| where SubjectUserName !endswith "$" // Filter out share accounts.
| project LogonTime = TimeGenerated, TargetUserName, Observer = Computer ;
DisabledAccount
| join ( LogonWithDisabledAccount ) on TargetUserName
| project LogonTime, TargetUserName, UserDisabledBy, DisabledOnDate, Observer

 

I've tried running each of the sections of this code and they give back results. But once I run the whole query, including the join, it gives back that no results have been found for the selected timerange, which is set to "In query" by the way.

 

Can you help me out? 

1 Reply
best response confirmed by stanleyk1 (Copper Contributor)
Solution
In a Analytics rule, you can go back 14days, not 30day - it will run in a normal logs window, as that doesn't have this setting.
https://docs.microsoft.com/en-us/azure/sentinel/tutorial-detect-threats-custom#query-scheduling-and-...


also - Tiander did a great webcast here: https://youtu.be/G6TIzJK8XBA?t=3152 – watch it all :smiling_face_with_smiling_eyes:, but “14days use case” starts at 42min
1 best response

Accepted Solutions
best response confirmed by stanleyk1 (Copper Contributor)
Solution
In a Analytics rule, you can go back 14days, not 30day - it will run in a normal logs window, as that doesn't have this setting.
https://docs.microsoft.com/en-us/azure/sentinel/tutorial-detect-threats-custom#query-scheduling-and-...


also - Tiander did a great webcast here: https://youtu.be/G6TIzJK8XBA?t=3152 – watch it all :smiling_face_with_smiling_eyes:, but “14days use case” starts at 42min

View solution in original post