Skip to main content
KBY Technologies Logo

Duplicate SPN Breaks Kerberos Sign-In to an Internal Service: Find It With setspn -X and Remove the Stale Copy

Medium severity Target recovery 60mActive Directory

Overview

Two accounts holding the same SPN stop Kerberos working for one internal service. Find the duplicate with setspn -Q and -X, save each account's SPNs, remove the stale copy with setspn -D, and test one client with klist.

Markdown, one checkbox per step, for pasting into a ticket.

Diagnose

Symptom

What responders observe.

Start here when users can no longer sign in to one internal service with their domain account, and nothing else on their machines is affected.

Typical reports are a web application, a file share alias or a database that suddenly asks for a username and password, or fails outright.

The failure began after someone installed a service, moved it to a new service account, or added a new DNS alias for it.

The System log on an affected client shows Event ID 4 from the Kerberos source, with the error KERB_AP_ERR_MODIFIED.

A network trace, if you have one, shows KDC_ERR_PRINCIPAL_NOT_UNIQUE for the requested SPN.

Microsoft notes that KERB_AP_ERR_MODIFIED can have more than one cause, so the diagnosis below rules out the clock first and only then looks for the duplicate.

Detection

Metrics, logs and confirmation commands.

Root cause

Why the incident occurred.

Contain and prevent

Blast radius

What else this can affect.

Prevention

Controls and guardrails that stop it recurring.

  • Register SPNs with setspn -S, never -A, so the duplicate check runs every time.

  • Record the SPN, its account and the service owner in the change record whenever a service moves to a new account or alias.

  • Run a duplicate search with setspn -X after any such change, outside working hours.

  • Delegate the Validated write to service principal name permission to the people who install services, rather than adding them to Domain Admins.

  • Keep a note of which services rely on the HOST SPN and which have their own, so the next incident starts with the right question.

Fix

Pre-flight checks

Check these before you change anything.

  1. An elevated command prompt on a domain controller and rights to read, and where needed write, the SPN (Enterprise Administrator for the duplicate search, Domain Admins or a delegated Validated write to service principal name for changes).

  2. The name of the service owner and the account the service logs on as.

Commands

setspn -Q <SPN>
setspn -X
setspn -L <AccountName>
setspn -L <AccountName> > spn-backup-<AccountName>.txt
setspn -D <SPN> <AccountName>
setspn -S <SPN> <AccountName>
klist get <SPN>
klist purge

Verify and recover

Verification

Evidence required before you close the incident.

  1. Run setspn -Q with the SPN the client requested. — Exactly one account listed, and it is the account the service runs under. — No second account holds the SPN.

  2. From one affected client, run klist get with the SPN and open the service. — A service ticket is returned and the user reaches the service without a credential prompt. — More than one affected user confirms.

  3. Read the System log on the client for new Event ID 4 entries from the Kerberos source. — No new KERB_AP_ERR_MODIFIED entries after the change. — No new entries after the change time.

Rollback

The safe way back.

  1. Restore any removed SPN to its original account with setspn -S from the saved setspn -L output, but only after the SPN has been removed from the other account.

  2. If the correct account was given an SPN it should not hold, remove it with setspn -D and compare the account's list to the saved output.

  3. A user who purged tickets and lost access logs off and on again.

Escalate when

Conditions that need another owner.

  • Escalate to the service owner if you cannot tell which account the service uses, or if the two accounts belong to different teams.

  • Escalate to the domain administrators if you lack the rights to read or write the SPN, or if setspn -X keeps failing for lack of time or memory.

  • Open a Microsoft support case if there is exactly one account holding the SPN, the clocks agree and the failure continues.

  • Include the Event ID 4 text, the SPN, the setspn -L output and a trace that shows the failing request.

  • Microsoft support Domain administrators Service owner.

The KBY Brief

Fixed? Get the next one before it hits you: The KBY Brief

Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.

Found this useful? Follow KBY for more like it.

Sources

Based on the vendor sources listed below. Check each step against your environment before acting.

First published 1 December 2026

More from KBY that goes with this runbook.

Duplicate SPN Breaks Kerberos Sign-In to an Internal Service