Forum Discussion
Azure Sentinel triggers incident when it shouldn't
stianhoydal The analytic rule will ignore any time details set in the query. As it states in the Set rule logic tab: Any time details set here will be within the scope defined below in the Query scheduling fields.
That may have something to do with it. Try running the query manually but use the value that is set In the Lookup data from the last field and see if that returns any results.
- stianhoydalSep 10, 2021Brass Contributor
So i figured out a simple workaround, but still the query wizard shows that it would trigger the alarm several times although it shouldn't have.
let excludedUsers = GuestAccountsExcludedFromCAPolicy_CL | distinct UserEmail_s; SigninLogs | where Location !in ( "AL","AD","AM","AT","BY","BE","BA","BG","CH","CY","CZ","DE","DK","EE","ES","FO","FI","FR","GB","GE","GI","GR","HU","HR","IE","IS","IT","LI","LT","LU","LV","MC","MK","MT","NO","NL","PL","PT","RO","RU","SE","SI","SK","SM","TR","UA","VA","SJ","") // List of country codes in europe. | where UserPrincipalName !in (excludedUsers) | extend AccountCustomEntity = Identity | extend IPCustomEntity = IPAddressThe GuestAccountsExcludedFromCAPolicy_CL is simply a table filled with users fetched from AAD via logic apps.
Still the query wizard shows that it would trigged multiple alarms within the last 48 hours although there should only be one.
It seems to me as if the query is just ignoring the line
| where UserPrincipalName !in (excludedUsers)
because it would be correct otherwise, but the whole point is to not get alerted when one of the excluded members tries to log on.
Anyone have any ideas on why this is happening, or potential solutions?
- GaryBusheySep 10, 2021Bronze ContributorIt looks right. I would double check the values you are getting in your custom tables to make sure they are matching what you are seeing in the SigninLogs.
You may also want to use a Watchlist for the locations to make it easier to keep up to date.- stianhoydalSep 14, 2021Brass ContributorFor anyone else that might have been wondering, seemingly the best way i found to make this work is to fetch the AAD group members into a custom table and update this according to how often you would want to run the analytics rule since the analytics rule wizard overrides any time references made in a query. If i want the query to run every 1 hour with the latest 1 hour of data i would need to update the custom table every 1 hour or less.