Forum Discussion
Change SQL Login to AD service account for Link server
Hi kevinfr820 ,
this usually happens when the AD service account is not properly mapped for the linked server connection. Please try using sp_addlinkedsrvlogin with @useself = false and specify the AD account under @rmtuser. Also, make sure Kerberos delegation is set up correctly and SPNs are registered for both servers. That should fix the login mapping error. here is the sample script
EXEC sp_addlinkedsrvlogin
@rmtsrvname = 'YourLinkedServerName', -- name of your linked server
@useself = 'false', -- use remote credentials
@locallogin = NULL, -- NULL = applies to all local logins
@rmtuser = 'DOMAIN\ServiceAccountName', -- your AD service account
@rmtpassword = NULL --Update the password
https://learn.microsoft.com/en-us/sql/relational-databases/linked-servers/create-linked-servers-sql-server-database-engine?view=sql-server-ver17