HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Will SYSTEM_USER return the unique user id for users authenticated by Active Directory

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
uniquedirectorytheactivereturnuserauthenticatedwillforsystem_user

Problem

I want to set up Active Directory authentication for my users, who will be assigned to specific database roles. I also need to log activity and ensure I have captured the IDs of the indivudals connected.

I have found simple instructions on how to do it. ( How do I assign an entire Active Directory group security access in SQL Server 2008? )

... But Will SYSTEM_USER return the logon id of the active directory connection or the individual user? (Unfortunately I cannot test this!)

Solution

A call to system_user will return the AD user's name in your case. For instance, if you have a user set up as YourDomain\YourUser1:

select system_user

-- this returns "YourDomain\YourUser1"


If YourDomain\YourUser1 is part of a AD group (i.e. YourDomain\YourGroup1), then it would still have the same output as above (returning "YourDomain\YourUser1").

Code Snippets

select system_user

-- this returns "YourDomain\YourUser1"

Context

StackExchange Database Administrators Q#20968, answer score: 2

Revisions (0)

No revisions yet.