Fix it now
0x80090322 is SEC_E_WRONG_PRINCIPAL, “The target principal name is incorrect”. Kerberos issued a ticket for one account and a different account answered, so the service could not open it. Your password is not the problem: somewhere in Active Directory the service principal name is registered twice, on the wrong account, or not at all.
setspn -X -F
setspn -Q MSSQLSvc/sql01.contoso.local:1433
setspn -L CONTOSO\svc_sql
klist purge
- Write down the exact name the client is connecting to, including whether it is a short name, a fully qualified name, an alias or a load balancer address. Kerberos asks for a ticket to that string, not to the server.
- Read the
setspn -X -Foutput. Anything listed twice is a live fault whether or not it is the one you are chasing, and duplicates are the commonest cause of this code. - Remove the name from the wrong account:
setspn -D <service>/<name> CONTOSO\wrongaccount. - Register it on the account the service actually runs as:
setspn -S <service>/<name> CONTOSO\svc_sql. The -S switch refuses to create a duplicate, which is why it should always be used instead of -A. - Purge cached tickets on the client with
klist purge, then reconnect. For something running under the computer identity, useklist -li 0x3e7 purgefrom an elevated prompt.
Duplicates are almost always created by setspn -A, which does not check first. Use setspn -S from now on and the problem stops recurring.
If the client connects and klist shows a ticket for the name you expected, you are done. If not, the next section covers the other three ways a ticket ends up unopenable.
Why it happens
When a client wants to reach a service by Kerberos it does not ask for the server. It asks for a service principal name: a string naming the protocol and the host, such as HOST/fs01.contoso.local or HTTP/intranet.contoso.local. The domain controller looks that string up, finds the account carrying it, and encrypts a service ticket with that account’s long-term key. The service decrypts the ticket with its own key and learns who you are. Everything in this family of failures is a variation on the ticket being encrypted with the wrong key.
If the name is registered on a computer account but the service runs as a domain user, the service holds the wrong key. If two accounts carry the same name, the domain controller picks one, and attempts that get the other account’s ticket fail – which is the maddening pattern of a system that works for some people and not others.
The name has to match what the client typed, not what the server is called. Connect through a DNS alias, a cluster name or a load balancer address and the client asks for a ticket to that name. Unless somebody registered it, no account holds it, and authentication either fails outright or drops to NTLM – which is why hardened environments see this error where relaxed ones silently limp along.
The companion codes are worth reading for what Microsoft publishes rather than what they are usually said to mean. 0x80070574 is Win32 1396, “The target account name is incorrect.” 0x80070575 is Win32 1397, “Mutual Authentication failed. The server’s password is out of date at the domain controller” – which names the diagnosis in the message. 0x80090303 is SEC_E_TARGET_UNKNOWN, the specified target is unknown or unreachable. 0x80090342 is SEC_E_KDC_UNKNOWN_ETYPE: the encryption type requested is not supported by the KDC. Note the direction of that last one – it is about what was asked for, not about what the target account supports.
The same service principal name is registered on two accounts
You have this one if setspn -X -F lists the name against more than one object, and failures come and go with no pattern.
- Decide which account the service genuinely runs under: the service’s Log On tab, or the application pool identity in IIS.
- Delete the registration from every other account:
setspn -D <service>/<name> <account>. - Purge tickets on an affected client and reconnect.
setspn -X -F reads the directory and changes nothing, so it is safe in production.
The name is missing after a service identity change
You have this one if Kerberos worked until somebody moved a service from the machine account to a domain user account, or changed which user it runs as.
- Register both the short and the fully qualified form on the new account, plus the port where the service class requires one.
- Confirm with
setspn -L CONTOSO\svc_account. - Restart the service, purge tickets on a client and retry.
A service under a domain account needs the name registered by hand. One running as Local System or Network Service is covered by the computer object’s own HOST entries.
Clients connect through an alias nobody registered
You have this one if Connecting to the real host name succeeds and the alias, cluster name or vanity name fails.
- Add the alias as an extra name on the account that answers:
setspn -S HOST/files.contoso.local CONTOSO\FS01$. - For file shares reached by an alias, the server may also need strict name checking relaxed, which is a registry change and a reboot.
- Retest by both names from a client with a purged ticket cache.
Export the registry branch first, and record the change where the next rebuild will find it.
The machine account key no longer matches
You have this one if A Kerberos failure naming KRB_AP_ERR_MODIFIED, usually after a restore from an image or snapshot, or a rebuild that reused the name.
- On the affected server, run
Test-ComputerSecureChannel -Verbosein an elevated PowerShell. - Repair it in place with
Test-ComputerSecureChannel -Repair -Credential (Get-Credential), supplying an account allowed to reset the object. - Purge tickets on the clients that were failing, since they may still hold a ticket encrypted with the old key.
The fix is correct but the client is still using an old ticket
You have this one if The directory looks right, another machine works, and one stubborn client keeps failing.
- Run
kliston the client to see which name it is holding a ticket for. - Purge with
klist purge, orklist -li 0x3e7 purgefor the computer identity. - Reboot if the failing component is a service that caches its own context.
Service tickets are valid for hours, so this heals itself eventually. Purging is faster.
Full reference
The codes, with their published wording
| Code | Symbolic name | Published meaning |
|---|---|---|
0x80090322 |
SEC_E_WRONG_PRINCIPAL | The target principal name is incorrect |
0x80070574 |
ERROR_WRONG_TARGET_NAME (1396) | The target account name is incorrect |
0x80090303 |
SEC_E_TARGET_UNKNOWN | The specified target is unknown or unreachable |
0x80070575 |
ERROR_MUTUAL_AUTH_FAILED (1397) | Mutual Authentication failed. The server’s password is out of date at the domain controller |
KRB_AP_ERR_MODIFIED |
Kerberos failure code 0x29 | Message stream modified |
0x80090342 |
SEC_E_KDC_UNKNOWN_ETYPE | The encryption type requested is not supported by the KDC |
KRB_AP_ERR_MODIFIED is worth a note. Microsoft documents it as failure code 0x29 in the failure-code table for Security event 4771, and that event is generated on domain controllers only. So if you have been told to look for it in the System log on the member server, look on a controller as well: that is where Microsoft documents it being recorded.
Matching the symptom to the fault
| What you see | Where to look |
|---|---|
| It works by real host name, fails by alias | No service principal name registered for the alias |
| It broke the day a service account changed | The name is still registered against the old identity |
| It fails for some users and not others, unpredictably | A duplicate registration on two accounts |
| It started after the server was rebuilt or restored | The machine account key no longer matches the directory’s copy |
| It was fixed but one machine is still failing | Cached tickets, which survive until they expire or are purged |
setspn, without breaking anything
| Command | What it does | Safe in production |
|---|---|---|
setspn -Q <service>/<name> |
Shows which account, if any, holds that name | Yes, read only |
setspn -X -F |
Lists duplicate registrations across the forest | Yes, read only |
setspn -L <account> |
Lists every name registered on that account | Yes, read only |
setspn -S <service>/<name> <account> |
Adds the name, refusing to create a duplicate | Yes, and it is the one to use |
setspn -D <service>/<name> <account> |
Removes the name from that account | Changes the directory. Know which account you mean |
setspn -A <service>/<name> <account> |
Adds without checking for duplicates | Avoid. This is how the duplicates got there |
When the directory is right and it still fails
- Check the client is asking for the name you think it is.
klistafter a failed attempt shows what it requested. - Check the service is running as the account you registered the name on, not as one that looks similar.
- Check whether the connection is even reaching Kerberos. Connecting by address cannot, so it will fall back to NTLM and produce a different failure.
- Check both the short and fully qualified forms are registered. Clients differ in which they ask for.
- Where the service class requires a port, check the port in the registration matches the port in use.
setspn -D changes the directory and takes effect immediately for every client that asks afterwards. Confirm the account you are removing the name from is genuinely wrong before you run it, because removing the name from the account that actually answers turns an intermittent failure into a total one.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
0x80090322 |
SEC_E_WRONG_PRINCIPAL: the target principal name is incorrect | Microsoft Learn |
0x80070574 |
Win32 1396, ERROR_WRONG_TARGET_NAME: the target account name is incorrect | Microsoft Learn |
0x80090303 |
SEC_E_TARGET_UNKNOWN: the specified target is unknown or unreachable | Microsoft Learn |
0x80070575 |
Win32 1397, ERROR_MUTUAL_AUTH_FAILED: mutual authentication failed, and the server’s password is out of date at the domain controller | Microsoft Learn |
KRB_AP_ERR_MODIFIED |
Kerberos failure code 0x29, published as “Message stream modified” in the failure-code table for Security event 4771, which is generated on domain controllers only | Microsoft Learn |
0x80090342 |
SEC_E_KDC_UNKNOWN_ETYPE: the encryption type requested is not supported by the KDC | Microsoft Learn |
Confirm the fix worked
setspn -X -Fno longer lists the name you fixed as a duplicate.setspn -Q <service>/<name>returns a single owner, and it is the account the service runs as.- On a client with a purged cache, connect and then run
klistto confirm a service ticket for the expected name was issued. - Check the target’s own logs for fresh Kerberos failures after the reconnection.
- Test from a second client, so you know the fix was in the directory and not on one machine.
Questions people ask about this
Does fixing this need a licence or a paid tool?
No. setspn, klist and the Active Directory tools are part of Windows and the free Remote Server Administration Tools. This is directory hygiene and costs nothing but the time to do it carefully.
Can I just turn Kerberos off and use NTLM?
You can force it in some applications, and it is a poor trade. NTLM is the weaker protocol, it is being restricted by default in more places with each release, and it breaks delegation. Registering the name properly takes minutes and leaves you somewhere supportable.
Is setspn -X safe to run in production?
Yes. It reads the directory and reports duplicates without changing anything. Add -F to search the whole forest rather than the current domain, which is what you want when services and clients live in different domains.
Why does it work for me but not for a colleague?
Almost always a duplicate registration. The domain controller picks one of the two accounts, so whether you succeed depends on which ticket you happened to receive and how long it is cached.
What does 0x80090342 mean exactly?
That the encryption type requested is not supported by the KDC. Read the direction carefully: it is about what was asked for. It usually turns up where an account or a client has been restricted to encryption types the domain no longer offers, or vice versa.
