why am I getting an SSPI context error when connecting to a SQL server from an entra joined jump host?

Dreamwarrior76 0 Reputation points
2024-01-31T16:19:06.4533333+00:00

Hi all, I am working with a vendor and they need to connect to our SQL VM through a Jump Host that is using Entra ID. We are getting the error "The target principle name is incorrect. Cannot generate SSPI context". This only happens from the jump host. It does not happen when we connect from any of the other VM's in the same subnet, resource group etc. Is it because Entra does not pass credentials as expected? Are there any workarounds? Thank you!

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,585 questions
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,362 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,632 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Andriy Bilous 11,176 Reputation points MVP
    2024-01-31T16:35:24.6233333+00:00

    Hello Dreamwarrior76

    The “The target principle name is incorrect. Cannot generate SSPI context” error occurs when a user tries to connect to a SQL Server instance using a domain account and receives the error message.
    This error message indicates that the SQL Server service cannot locate a domain controller(Entra ID) to authenticate the user’s account.

    There are multiple reasons for this error. Here are couple reasons and solutions to fix an error:


  2. Erland Sommarskog 107.2K Reputation points
    2024-01-31T22:11:30.6533333+00:00

    So they log on to the VM with Entra ID, and then they try log on to SQL Server with Windows Auth?

    I cannot claim a whole lot of expertise in this area, but I would only expect this to work if you have SQL 2022, and you have enabled the instance for Entra ID authentication. And the vendor would have to select Microsoft Entra Integrated.

    For Windows Authentication to work, there has to be a Windows user somewhere.

    0 comments No comments

  3. Pinaki Ghatak 3,265 Reputation points Microsoft Employee
    2024-02-01T09:09:04.1966667+00:00

    Hello @dreamwa The error “The target principal name is incorrect. "Cannot generate SSPI context” typically occurs when you use Windows authentication to connect to a SQL Server instance remotely.

    This error means that SSPI (Security Support Provider Interface) tries but can’t use Kerberos authentication to delegate client credentials through TCP/IP or Named Pipes to SQL Server. In most cases, a misconfigured Service Principal Name (SPN) causes this error.

    A Service Principal Names (SPN) is a unique identifier of a service instance. SPNs are used by Kerberos authentication to associate a service instance with a service logon account. For example, a typical SPN for a server that is running an instance of SQL Server is as follows: MSSQLSvc/SQLSERVER1.northamerica.corp.mycompany.com:1433.

    If the SPN is not configured correctly, or if the client system is not able to reach the Domain Controller, it can result in the error message you’re seeing. One possible solution is to delete the registered SPN for your SQL Service under the incorrect account, and then register the SPN under the correct service account.

    I hope this answers your question, and the links provided helps you.

    0 comments No comments