Marco - Wow...that all sounds impressive. Unfortunately, I have no idea what you are talking about...:blush:. I'm really just an old-school programmer that tries to put on a DBA or IT hat when nobody else will.
Seriously...what you desribed sounds good. The results you mentioned remind of when I have an ASP page that uses Integrated Security and the page tries to access a database on another server. This fails because of the "hop" from Server01 (IIS) to Server02 (SQL). Server01 can't pass the credentials to Server02 so Server02 tries to authenticate Server01 as anonymous...which, of course, fails. I don't think there is any way around it in my web-to-sql environment...which is fine with me....I like handling security in the app istelf anyway.
As for your scenario - I'm not familiar with the way you are accessing the linked server. Is that how impersonation works when done entirely through TSQL? I thought you could only do that with a sproc...didn't know it could be done in-line like that. You don't need to pass the password or anything? Interesting.
In SSMS on Server02, while in your security context, can you execute any 4-part-name queries or open querires against the liked server? Something like this (assuming the linked server name is "SERVER01_LINKED"):
SELECT * FROM SERVER01_LINKED.test.dbo.sysobjects
--or
SELECT * FROM OPENQUERY(SERVER01_LINKED, 'SELECT * FROM test.dbo.sysobjects')
Another question: How is the linked server's security configured? Are you using the login mapping with impersonation that I mentioned or are you using the, "Be made using the logins's security context" option that Lowell mentioned? I'd try Lowell's method first....much easier. If that doesn't work, try adding domain\User01 mapping to the table and check the impersonate box. You'll need to be logged in as domain\User01 to test either technique. I can't vouch for the use of Execute As for domain accounts...maybe that works, maybe not, maybe it only works under certain situations, I don't know.
Ah, just found this MSKB 181362. But it sounds like you are on top of it based on your results....you actually switched context.
mchofman (3/30/2010)
...but I still receive an error with the query below (I have run it locally on Server02 and through SSMS on my client on Server02):SELECT SUSER_NAME()
EXECUTE AS LOGIN='Domain01\User01'
SELECT SUSER_NAME()
EXEC sp_executesql N'SELECT * FROM SERVER01.test.dbo.sysobjects'
REVERT
SELECT SUSER_NAME()
Result:
Domain01\MyAccount
Domain01\User01
Msg 18456, Level 14, State 1, Line 1
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
The only thing I can suggest is to check the linked server's security configuration and then your syntax for using the linked server.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply