Kerberos 0x80090322: duplicate or misplaced SPN
Diagnose and fix a Kerberos KRB_AP_ERR_MODIFIED error caused by an HTTP SPN registered on the wrong account.
Error 0x80090322 or a Kerberos fallback to NTLM when connecting to a service (here a reporting server over HTTP) is often caused by a duplicate or misplaced Service Principal Name (SPN). This article shows how to confirm it and fix it.
Check the authentication scheme
From the client, check which scheme a SQL Server connection really uses:
sqlcmd -E -S sqlserver01 -Q "SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id=@@SPID"
The result is KERBEROS or NTLM.
Enable Kerberos event logging
Enable Kerberos logging on the machine to get detailed errors in the System event log:
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters\ /v LogLevel /t REG_DWORD /d 0x1
| Item | Value |
|---|---|
| Key | HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters |
| Value name | LogLevel |
| Type | REG_DWORD |
| Data | 0x1 |
Read the event
In Event Viewer, open the System log and look for source Microsoft-Windows-Security-Kerberos, Event ID 4:
Log Name: System
Source: Microsoft-Windows-Security-Kerberos
Event ID: 4
Level: Error
Computer: app01.contoso.com
Typical description:
The Kerberos client received a KRB_AP_ERR_MODIFIED error from the server app01$.
The target name used was HTTP/app01.contoso.com. This indicates that the target
server failed to decrypt the ticket provided by the client. This can occur when
the target server principal name (SPN) is registered on an account other than
the account the target service is using. Ensure that the target SPN is only
registered on the account used by the server.
KRB_AP_ERR_MODIFIED means the server could not decrypt the ticket: the SPN points to an account that is not the one running the service, or the service account password differs from what the KDC holds.
Find where the SPN is registered
setspn -Q HTTP/app01.contoso.com
Example output:
Checking domain DC=contoso,DC=com
CN=svc_report,OU=Users,DC=contoso,DC=com
HTTP/app01.contoso.com
HTTP/app01
Existing SPN found!
Here the SPN is registered on a user account (svc_report) while the service runs as the machine account (app01$).
Fix
Remove the SPNs from the wrong account, then register them on the account that actually runs the service (here the computer account):
setspn -D HTTP/app01.contoso.com CONTOSO\svc_report
setspn -D HTTP/app01 CONTOSO\svc_report
setspn -A HTTP/app01.contoso.com app01$
setspn -A HTTP/app01 app01$
Notes
- In the original case the root cause was a reporting server installation that had registered the HTTP SPNs on a service account.
- Host names, domain and account names are generic examples.