SQL Server AUDIT for AD Group or sysadmin group

  • Hello,
    please I need to do sql audit for all group or for all sysadmin.
    I want to do dynamic, so its means when somebody will add someone, dont want to care about it, but lets track automaticaly.

    I tried to input there AD group like server principal name, also sysadmin and nothing.
    Is there any option how to do ??

    Thanks

  • ([server_principal_name]='sa' OR [server_principal_name]='sysadmin')   

    sa was ok, but another sysadmin didnt catch..

  • ([server_principal_name] in (select name from sys.syslogins where sysadmin=1))

  • goher2000 - Monday, March 12, 2018 1:45 PM

    ([server_principal_name] in (select name from sys.syslogins where sysadmin=1))

    Hi,

    did you tested ?
    I tried also and have problem with in --

    tried also with script and with studio and errors

    Msg 156, Level 15, State 1, Line 16
    Incorrect syntax near the keyword 'in'.
    Msg 102, Level 15, State 1, Line 16
    Incorrect syntax near ')'.

  • Ok, 

    so with some testing I see that
    ([database_principal_name]='dbo') 

    should be all sysadmin and also dbo, but not sure if I am really right. But for now best for me.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply