Description
Describe the bug
Upon updating from 5.1.5 to 5.2.0, our applications running on Linux fail to connect to our databases using Integrated Security / Kerberos with an error:
Microsoft.Data.SqlClient.SqlException (0x80131904): The target principal name is incorrect. Cannot generate SSPI context.
This is with a connection string such as:
"Data Source=server.domain.local;Integrated Security=true"
server.domain.local
here is a CNAME which resolves to server001.domain.local
In version 5.1.5 I can see it resolves the SPN in 2 different ways. It first resolves the SPN without the port number, and if that fails it retries with the port number in the SPN.
1st try -> MSSQLSvc/server001.domain.local@DOMAIN.LOCAL
2nd try -> MSSQLSvc/server001.domain.local:1433@DOMAIN.LOCAL
< Lookup successful
In version 5.2.0, it only resolves the SPN without the port number, and then performs no more searches causing connectivity to fail.
1st try -> MSSQLSvc/server001.domain.local@DOMAIN.LOCAL
Our workaround has been to specify the port number in the connection string.
"Data Source=server.domain.local,1433;Integrated Security=true"
Is this change of behaviour intentional or a result of a bug? We're not sure if this will be fixed in SqlClient, or if we should update our SPNs, or whether we should start including port numbers in all our connection strings.
Further technical details
Microsoft.Data.SqlClient version: 5.2.0
.NET target: 8.0
Operating system: Linux Container
Metadata
Metadata
Assignees
Labels
Type
Projects
Status