Linked Server to AD - Error when using username and password

  • Hello,  I've set up a LinkedServer to a AD that I have access to with my Username.
    Case 1: The Linked Server gets the option to Used in the current security context of the application. Now I can run the Select from OpenQuery query on the LDAP.
    Case 2: The Linked Server gets the option used in the following security context.  I entered my user and my password. This gives the error: Error while preparing the .... Query for execution for the OLE DB provider 'ADsDSOObject' for the connection server
    Case 3: Now I'm entering a wrong password on the Linked Server from Case 2. Now the message is : The provider indicates that the user does not have permission to perform the operation.
    From case 3, I conclude that user and password are correct in case 2 - but for what reason can not the query be executed? Thank you for your efforts!
    (sorry for the english  - i am using the german version of sql Server, i dont know how the messages are in the english version)

  • Setting up a linked server with ADSDSOObject probably won't work with Case 2, I believe the "be made using this security context" option is designed for use with SQL Authenticated users only, and you need an AD user to connect to AD
    https://docs.microsoft.com/en-us/sql/relational-databases/linked-servers/create-linked-servers-sql-server-database-engine?view=sql-server-2014

    The linked server permissions may also be affected if the computer you are running the query from is not the server itself.  For example, I have a linked server setup on my local computer's SQL Server instance to AD and it works fine either explicitly putting my user in the "Local Login" listing and check the Impersonate checkbox, or if I leave that section blank and use "Be made using the logins current security context" like you describe in Case 1. 

    However, if I make the same linked server on a separate SQL Server instance, but try to run a query using my local Management Studio I get errors like you see "An error occurred while preparing the query"  This linked server does work though if I'm running Management Studio on the server with the instance instead of locally from my computer.  It's probably some inability to redeligate the permissions from your local computer, to the SQL Server, then to AD.

    Hope some of this helps.

Viewing 2 posts - 1 through 2 (of 2 total)

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