0

I'm trying to connect a .Net Core application running in a Linux container to a SQL Server database. Our DBA's require us to use AD users to connect to SQL Server. Another team is using NodeJS and seriate to connect using an AD user and password. Using those same creds in .Net Core is giving me a Login failed for user error. Am I missing something in the connection string?

DataSource=MyServer;Initial Catalog=MyDatabase;User Id=MyUsername;Password=MyPassword;Encrypt=true;

3
  • I added the connection string. It works from a nodejs app using seriate npm package which wraps node-mssql package and uses the msnodesqlv8 driver.
    – Lee O.
    Commented Aug 28, 2020 at 1:32
  • The apps run in a Linux docker image running in mesosphere and are not part of the domain. From what I can tell, that shouldn’t be possible but it is working for the nodejs team.
    – Lee O.
    Commented Aug 28, 2020 at 1:33
  • Looks like the nodejs packages are using the TDS protocol which uses NTLM to authenticate using a domain account and username/password. Appears that .Net Core does not support this.
    – Lee O.
    Commented Aug 28, 2020 at 2:00

1 Answer 1

0

NTLM auth is not supported in official SqlClient package as below link https://github.com/dotnet/SqlClient/issues/143

However, a talent guy provided a temporary solution here https://github.com/dotnet/SqlClient/issues/31

So, you have to fork a dotnet SqlClient repo and add this talent code in https://github.com/dotnet/SqlClient/blob/v4.1.0/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs#L8403

Not the answer you're looking for? Browse other questions tagged or ask your own question.