Forum Discussion

Ivan Koshkin's avatar
Ivan Koshkin
Copper Contributor
Jun 20, 2018
Solved

Create query with "where" clause that targets multiple accounts.

I would like to query multiple account's for the same event ID. I tried the syntax below, and it doesn't give me a syntax error, but when I test it there are no results.   SecurityEvent | where Ev...
  • Emilian Ertel's avatar
    Jun 22, 2018

    I assume that you only need to have the the or statement in the same line with the where clause and it should work.


    However, I would prefer the following approach:

     

    datatable (EventID:int, TargetAccount:string)
    [
    4723, "Domain\\Administrator",
    4711, "Domain\\Administrator",
    4711, "Domain\\ServiceAccount",
    4724, "Domain\\ServiceAccount",
    4723, "Domain\\ServiceAccount",
    4724, "foo.bar",
    ]
    | where EventID in (4723, 4724)
    | where TargetAccount in ("Domain\\Administrator","Domain\\ServiceAccount")

Resources