Having a sql authentication user ID with Integrated Security=SSPI, which will take the precedence?

Subash Basnayake 61 Reputation points
2024-01-19T11:21:57.3066667+00:00

I have an SSIS package and in that, I connect to SSISDB using the following connection string.

Data Source=ABC1234;User ID=TST_USR;Initial Catalog=SSISDB;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;

The provider is Native OLEDB\SQL Server Native Client 11.0.

The UserId and password are passed to the connection. TST_USR is a SQL auth type login.

In a scenario like this, what will be the connection attempt?

  • A Windows auth attempt or SQL auth attempt?
  • Is the "integrated security = SSPI" ignored because the SQL auth username and password are provided?
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,229 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,505 questions
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 105.8K Reputation points MVP
    2024-01-19T22:52:54.98+00:00

    I don't know on the top of my top. My gut reaction is Don't do that!

    But if you want to know, add an Execute SQL task with SELECT SYSTEM_USER and see what you get back.

    0 comments No comments

  2. Ken Kam Hung, Lin 91 Reputation points
    2024-01-22T01:54:19.7566667+00:00

    If you provide "Integrated Security=SSPI;" to the connection string, it will be using Integrated Security to login to SQL (with the current windows account or service account that you applied to run the application). It will ignore the username and password even if you provide them in the connection string.


  3. ZoeHui-MSFT 34,916 Reputation points
    2024-01-22T02:52:23.02+00:00

    Hi @Subash Basnayake,

    The Integrated Security property instructs the SQL Client to connect to SQL Server using Windows Authentication through the Security Support Provider Interface (SSPI). Recognized values are true, false, yes, no, and sspi , which is equivalent to true.

    Connection String Syntax

    When this property value is true or yes, the DRDA Service will connect to SQL Server using Windows Authentication.

    When this property value is false or no, the DRDA Service will connect to SQL Server using SQL Server Authentication.

    See Configuring SQL Server Connections

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.