SQL Server Connection Object with Active Directory User

Discussion created by Tyler_Auerbeck_8064 on Nov 13, 2016
Latest reply on Nov 22, 2018 by Roney.Uba
Does anybody have an example of how to create a connection object for SQL Server using an active directory user? I've filled in the basic information (database,server) and then selected the alternative login as the LOGIN object containing my active directory user that has access to the database. However I just keep getting login failed. I've also tried supplying trusted_connection = true in the connection string additional parameters, but that doesn't seem to work either.

Ultimately, I'm just trying to use this connection object so that I can create a SQL variable that connects out to an external application database to get a piece of information. In most other cases I just use a SQL job where I provide the database name and server name, then specify my login object for the AD user. This works without issue. The only problem I seem to be having is the authentication when using these pieces of information in a connection object.