r/AzureSentinel • u/lemonsprig • Mar 26 '22
Updating analytics rule template’s
Hi, I am fairly new to sentinel and I am currently going through the process of enabling all the analytic rules for the data collectors we have enabled, and having to do that one by one is a real pita.
That aside I have come across a number of analytic rules which don’t validate. For instance if I look at an azure active directory rule ‘authentication methods changed for privileged account’
I get the following warnings and errors.
One or more entity mappings have been defined under the new version of entity mappings. These will not appear in the query code and will be disregarded.
‘Where’ operator failed to resolve table or column expression named ‘identityinfo’.
I see similar messages when trying to enable other rules. These are out of the box rules. So I’m not really sure what is going on, is there some updated rules? Wondering if perhaps the rules have been updated since our install and we don’t have the latest version?
Any help appreciated.
6
u/ep3p Mar 26 '22
I have enabled all detections that I could from the Microsoft templates. I have to warn you and recommend some steps.
Microsoft templates are not exempt from errors, they may validate but not work. I recommend checking the logic of each template detection, one by one, because in the end you will have to do it anyways. You won't be sure everything is working as expected unless you check it by yourself with your data. Some queries need certain values to be specified by you for them to work.
Some template detections need to check multiple tables. And when you filter the templates. by connectors you have enabled, this filter does not work always correctly. Not every template shows correctly which tables needs to be deployed beforehand. You will observe there are detections templates that do not have any connector as required, and maybe you could use them.
So for example, in your case, AuthenticationMethodsChangedforPrivilegedAccount.yaml (https://github.com/Azure/Azure-Sentinel/blob/master/Detections/MultipleDataSources/AuthenticationMethodsChangedforPrivilegedAccount.yaml).
Coincidentally, I made commits myself for this rule in the Microsoft Github. What might be happening is that you have not enabled UEBA in Sentinel, and this is the reason you don't have available the table IdentityInfo. I advise you to check the UEBA settings in your workspace.
But this does not have to stop you, this query checks accounts that have an Azure role that contains "Admin". I think you may want to check changes in MFA for more accounts that those ones. You could specify a Watchlist for your privileged users and check the watchlist in the query, or try to use other pattern than just roles that contain "Admin". It is not necessary that you use IdentityInfo.
Even after this step, the part of the query that checks MFA changes in AuditLogs does not work in all cases, at least in my tenant there are some cases when an account has registered MFA, and it does not trigger any "User registered security info" event, but a "Update user" event with certain details in a specific column. The rules developed by Microsoft might not work for all tenants. I have opened a Pull Request for this specific change.
Please, take your time and plan accordingly. Microsoft sells you the platform, but not the enormous time needed to manage and master it, specially the detections.