大网数据广告活动
数据库与应用安全

Explicit misplaced SPN error in SQL Server

· 52CE 我爱测

This article provides a workaround for the SQL Server consistent authentication problem where the explicit SPN is misplaced.

This article helps you resolve a SQL Server consistent authentication problem that affects the explicit misplaced Service Principal Name (SPN).

Symptoms

If the SPN that you specify in the connection string exists on a service account that's not used by Microsoft SQL Server, you receive a Security Support Provider Interface (SSPI) context error message.

If the SPN isn't registered correctly, you might receive the following error message:

The target principal name is incorrect. Cannot generate SSPI context.

If you try to create an SPN that already exists, you receive the following error message:

Duplicate SPN found, aborting operation!

Cause

The explicit misplaced SPNs can cause issues in Kerberos authentication and prevent clients from connecting to the service.

Resolution

If you are experiencing explicit misplaced SPNs, you might have to create or re-create the SPN for the service. To create or re-create the SPN by using the SETSPN command, follow these steps:

  1. Run the SETSPN -L domain\svcacct command to list SPNs on the SQL Server service account.
  2. Run the SETSPN -Q spnName command to learn which service account the SPN is registered on.
  3. Run the SETSPN -D command to remove the SPN from the service.
  4. Run the SETSPN -A command to add the SPN to the service.
  5. Move the SPN by using SETSPN -D, or select an SPN that already exists in the correct account.

More information

Consistent authentication issues in SQL Server

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 03/28/2024
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。