Forum Discussion

MiguelCuba's avatar
MiguelCuba
Copper Contributor
Oct 11, 2022
Solved

Comparing Watchlist items with json object

I'm using watchlist as a whitelist in an analytic rule in sentinel but when i try to compare with a variable in auditlog named "AccountUPN" it still showing me users that are included in this watchli...
  • Clive_Watson's avatar
    Clive_Watson
    Oct 11, 2022
    Here is my version and it works with my Watchlist

    let watchlst_ =_GetWatchlist("upnList") | project Analysts, _DTItemId;
    AuditLogs
    | where OperationName in~ ('Remove member from group', 'Remove owner from group')
    | extend AccountUPN = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
    | where isnotempty(AccountUPN)
    | where AccountUPN !startswith 'adm'
    | where AccountUPN !in~ (watchlst_)
    | summarize test = count() by AccountUPN
    | order by test desc

    Maybe the watchlist has issues - control characters/ trailing spaces etc,.. in the rows?

Resources