Core component of SQL Server for storing, processing, and securing data
server_principal_name in SQL Server Audit is the login name seen by the instance, not the Windows group name. Filtering on server_principal_name = 'DOMAIN\WindowsGroup' will therefore never match individual members of that group.
Key points and options:
-
server_principal_namevalue- For Windows authentication,
server_principal_nameis typically the individual Windows login, for exampleDOMAIN\User1, not the AD group. - When a user connects via a Windows group that has permissions, SQL Server still records the effective login as the user account, not the group.
- For Windows authentication,
- Why the filter does not work
- The predicate
(server_principal_name = 'DOMAIN\WindowsGroup')only matches if the login name itself is exactlyDOMAIN\WindowsGroup. - Members of that group connect as
DOMAIN\UserX, so no audit rows satisfy the predicate and nothing is captured.
- The predicate
- Practical solutions
- Grant access via individual logins and filter on those, for example:
(server_principal_name IN ('DOMAIN\\User1', 'DOMAIN\\User2')) - Or, if possible, create a dedicated login (e.g.
DOMAIN\SqlAdmins) that is used directly and filter on that login name. - If the goal is to audit administrators, follow the documented guidance and audit the
dbouser or the relevant admin action groups instead of trying to filter by Windows group name. Members of thesysadminfixed server role are mapped todboin each database.
- Grant access via individual logins and filter on those, for example:
- Additional considerations
- Ensure the audit itself is enabled and attached to a Server Audit Specification that includes the relevant server-level or database-level action groups.
- If using a predicate, confirm it is syntactically correct and enclosed in parentheses, as required.
References: