MSSQL Server ошибка при подключении — The target principal name is incorrect. Cannot generate SSPI context.

В один момент не смог подключится к своему MSSQL Server используя Windows Authentication, получал ошибку — The target principal name is incorrect. Cannot generate SSPI context.

В логах видно что не удается зарегистрировать Service Principal Name (SPN) службы SQL Server:

Date        1/27/2023 4:31:22 PM
Log        SQL Server (Current - 1/27/2023 5:12:00 PM)
Source        Server
Message
SQL Server is attempting to register a Service Principal Name (SPN) for the SQL Server service. Kerberos authentication will not be possible until a SPN is registered for the SQL Server service. This is an informational message. No user action is required.

Date        1/27/2023 4:31:22 PM
Log        SQL Server (Current - 1/27/2023 5:12:00 PM)
Source        Server
Message
The SQL Server Network Interface library could not register the Service Principal Name (SPN) [ MSSQLSvc/n******4005.example.local:N******4005 ] for the SQL Server service. Windows return code: 0x21c7, state: 15. Failure to register a SPN might cause integrated authentication to use NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies and if the SPN has not been manually registered.

 

Быстро диагностировать и исправить проблемы можно утилитой — Microsoft Kerberos Configuration Manager (KCM).

 

На компьютере, на котором возникла проблема с подключением, скачиваем и устанвливаем Kerberos Configuration Manager.

Скачать можно с официального сайта — https://www.microsoft.com/en-us/download/details.aspx?id=39046

 

Запускаем KerberosConfigMgr.exe из папки C:\Program Files\Microsoft\Kerberos Configuration Manager for SQL Server используя учетную запись домена, у которой есть разрешения для подключения к компьютеру SQL Server, к которому не можем подключиться.

Нажимаем Connect. На форме подключения оставляем имя сервера и учетные данные, пустыми.

 

Читать далее