How do I capture the Windows Account associated with a SQL Server Login?

Greetings, We have an issue with our Web application's SQL Server login and Windows account auditing. A user logs on with somedomain\someaccount (Windows account) to run the application and then a SQL Server login is used to access the database. I need to return the Windows account that is using the SQL Server login. Ideally, I want to leverage SQL Server Audit to capture database insert/delete/update processes by Windows account and SQL Server login. Is there any way to capture what Windows account is using a SQL Server login? I’d like to run a nightly SQL Server Agent job to load an audit table based on what is captured using SQL Server Audit and relate this data to the two accounts. Thanks!

more ▼

asked Jan 02, 2016 at 07:16 PM in Default

avatar image

20 2 2 4

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

It sounds like you need auditing at the web application level. Since the connection to SQL Server is using a SQL Server login, that's what it knows. I briefly considered whether or not the host machine would help, but it won't because this is a web application. SQL Server will see everything as the same login coming from same web server(s).

more ▼

answered Dec 22, 2015 at 06:58 PM

avatar image

Tom Staab ♦
14.5k 7 15 21

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jan 02, 2016 at 07:16 PM

Seen: 7374 times

Last Updated: Jan 02, 2016 at 07:16 PM

Copyright 2018 Redgate Software. Privacy Policy