---
title: Service Principal Names (SPN) – Kerberos for SQL Server and IIS in Nodinite
description: Hub guide to Service Principal Names (SPNs) in Nodinite. Learn how SQL Server (MSSQLSvc) and IIS (HTTP) SPNs differ, when SPNs are required, the shared setspn commands, service account rules, and which spoke guide fixes your Kerberos problem.
---

# <i class="fal fa-key" aria-hidden="true"></i> Service Principal Names (SPN): Solving the "Cannot Generate SSPI Context" Mystery

You've deployed <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> across several servers: the [Web Client][] on [IIS][IIS Overview], the Logging and Monitoring Services on an application server, and the databases on SQL Server. You select **Test Connection** and get:

> **"Cannot generate SSPI context"**

Or users open the Web Client and get a login prompt instead of signing in automatically. Or a linked server query fails with:

> **"Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'"**

All three symptoms usually share one root cause: a missing, duplicate, or misplaced **Service Principal Name (SPN)**, which stops Kerberos authentication from working across server boundaries.

SPNs show up in two different places in a <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> installation, and the two problems are **related but not the same**:

* **SQL Server SPNs (`MSSQLSvc/...`)** - <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> services and SQL Server instances authenticating to each other, including linked server hops between the [Configuration Database][] and [Log Databases][].
* **IIS HTTP SPNs (`HTTP/...`)** - users' browsers and API clients authenticating to IIS-hosted <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> services: the [Web Client][], [Web API][], [Log API][], [Logging Service][], [Monitoring Service][], [MCP Endpoint][], and [Pickup Service][].

This page is the hub. It explains the shared concepts and commands once, then sends you to the guide for your problem:

* <i class="fal fa-database" aria-hidden="true"></i> [SQL Server SPNs (MSSQLSvc)][SQL Server SPN] - default and named instances, failover clusters, Always On, linked servers, and delegation
* <i class="fal fa-globe" aria-hidden="true"></i> [HTTP SPNs for IIS][IIS HTTP SPN] - Web Client hostnames, web farms, `useAppPoolCredentials`, and HTTP SPN ownership conflicts

<aside aria-label="Important" class="nodinite-note nodinite-note--important">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-message-exclamation"></i> Important</p>
<div class="nodinite-note__content"><p><strong>NTLM-disabled environments:</strong> many organizations disable NTLM for security compliance, which forces Kerberos-only authentication. Without NTLM there's no fallback: if a required SPN is missing, the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Web Client, Monitoring Service, and Logging Service fail to authenticate. In these environments SPNs are <strong>mandatory</strong>, for both SQL Server and IIS.</p></div>
</aside>

## <i class="fal fa-triangle-exclamation" aria-hidden="true"></i> What Goes Wrong Without Proper SPNs

* **Deployment delays** - installations that work on a single developer machine fail in multi-server production environments.
* **Silent fallback to NTLM** - systems fall back to the weaker NTLM protocol without warning, which creates compliance gaps and, for IIS, slow page loads.
* **Intermittent failures** - Kerberos works on one cluster node or web farm node but not another.
* **Linked server breakdowns** - the Configuration Database connects, but queries to remote Log Databases fail as anonymous logon.
* **Post-failover surprises** - a cluster or Availability Group fails over, and applications can't authenticate to the new active node.
* **Unexpected login prompts** - the Web Client asks for credentials instead of signing users in transparently.

## <i class="fal fa-network-wired" aria-hidden="true"></i> Understanding SPNs and Kerberos

An SPN is a unique identifier in Active Directory that maps a service instance, such as `MSSQLSvc/sql-prod-01.contoso.com:1433` or `HTTP/nodinite.contoso.com`, to the account the service runs as. When a client wants to connect, it asks the Domain Controller for a Kerberos ticket for that SPN. The Domain Controller encrypts the ticket with the key of the account that owns the SPN, so only that service can read it.

That gives Kerberos two hard requirements:

* **Exactly one owner** - each SPN must exist on exactly one account in the forest. A missing SPN makes Kerberos fail or fall back to NTLM; a duplicate SPN makes it fail.
* **The right owner** - the SPN must be on the account the service actually runs as. If the ticket is encrypted for another account, the service can't decrypt it.

```mermaid
flowchart LR
    Browser["fa:fa-user Browser"]
    DC["fa:fa-shield-halved Domain Controller<br/>Kerberos KDC + SPN lookup"]
    IIS["fa:fa-globe IIS: Web Client / Web API<br/>HTTP SPN on app pool account"]
    Svc["fa:fa-gears Logging / Monitoring Service"]
    SQL["fa:fa-database SQL Server: Configuration Database<br/>MSSQLSvc SPN on SQL service account"]
    SQL2["fa:fa-database Remote SQL Server: Log Database<br/>MSSQLSvc SPN on SQL service account"]
    Browser -->|"1. Ticket for HTTP/nodinite.contoso.com"| DC
    Browser -->|"2. Present ticket"| IIS
    Svc -->|"3. Ticket for MSSQLSvc/sql-prod-01"| DC
    Svc -->|"4. Present ticket"| SQL
    SQL -->|"5. Delegated ticket (linked server)"| SQL2
    IIS -.->|"Web API also connects as a SQL client"| SQL
    style Browser fill:#2678BD
    style IIS fill:#2678BD
    style Svc fill:#E47528
    style SQL fill:#E47528
    style SQL2 fill:#E47528
    style DC fill:#9E59BB
```

*Diagram: the two SPN paths in a <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> installation. Blue nodes are the IIS path ([HTTP SPN][IIS HTTP SPN] for the [Web Client][] and [Web API][]); orange nodes are the SQL Server path ([MSSQLSvc SPN][SQL Server SPN] and [delegation][Trusted for delegation]); purple is Active Directory, which both paths depend on.*  

### Key Components Explained

| Component | Role | Requirement |
| --- | --- | --- |
| Domain Controller (KDC) | Issues Kerberos tickets and looks up which account owns an SPN | Reachable from clients and servers; time in sync |
| Service account | The identity a service runs as (SQL Server service, IIS application pool, Windows service) | Domain account or gMSA for distributed Kerberos |
| SPN | Maps `serviceclass/host[:port]` to the service account | Registered once, on the correct account |
| Client | Requests a ticket for the SPN built from the name it connects to | Must connect with a name that has an SPN |
| Delegation | Lets a service forward the user's identity to another service | Needed for double hops, such as linked servers |

## <i class="fal fa-code-compare" aria-hidden="true"></i> SQL Server SPNs vs IIS HTTP SPNs

Both use the same Active Directory mechanism and the same `setspn` tool, but they break in different ways and get fixed in different places.

| Aspect | SQL Server (`MSSQLSvc`) | IIS (`HTTP`) |
| --- | --- | --- |
| Who authenticates | <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> services, [Web API][], and SQL Server itself ([linked servers][Linked Servers]) | Users' browsers and API clients |
| SPN format | `MSSQLSvc/host[:port or instance]` | `HTTP/hostname`, even when the site uses HTTPS |
| Names to register | Every node, cluster, and listener name, with port and instance variants | Every hostname clients type: DNS alias and machine name, short and FQDN |
| SPN owner | SQL Server service account | [IIS][IIS Overview] application pool account, or the computer account for built-in identities |
| Server-side settings | None for SPNs; [delegation][Trusted for delegation] for [linked servers][Linked Servers] | `useKernelMode` and `useAppPoolCredentials` in [IIS Windows Authentication][IIS Authentication settings] |
| Can register itself | Yes, if the service account has the rights; otherwise a Domain Admin registers it | No for domain accounts; a Domain Admin registers it |
| Typical symptom | "Cannot generate SSPI context", anonymous logon on [linked servers][Linked Servers] | [Login prompt][Login Prompt], 401 Unauthorized, slow pages from NTLM fallback |
| Typical special case | Failover clusters and [Always On listeners][AlwaysOn] on different ports | Machine-name URL conflicting with the computer account's `HOST/` SPN |
| Validation tool | Microsoft Kerberos Configuration Manager for SQL Server | `klist`, browser Intranet Zone, `setspn -Q` |
| Full guide | [SQL Server SPNs (MSSQLSvc)][SQL Server SPN] | [HTTP SPNs for IIS][IIS HTTP SPN] |

### Which Guide Do You Need?

| Symptom | Start here |
| --- | --- |
| "Cannot generate SSPI context" when a <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> service or tool connects to SQL Server | [SQL Server SPNs][SQL Server SPN] |
| Linked server queries fail with `NT AUTHORITY\ANONYMOUS LOGON` | [SQL Server SPNs][SQL Server SPN], then [Trusted for delegation][] |
| Kerberos fails after a cluster or Always On failover | [SQL Server SPNs][SQL Server SPN] |
| Login prompt or 401 in the Web Client | [HTTP SPNs for IIS][IIS HTTP SPN] |
| Login prompt after upgrading from v6 to v7 | [Kerberos Transparent Login After v7 Upgrade][Kerberos Transparent Login] |
| Web Client is slow but no login prompt appears | [NTLM vs Kerberos Authentication][] |
| `setspn -S` fails with `0x21c7/8647` | The duplicate SPN error section under **Shared setspn Commands** below, then the matching guide |

## <i class="fal fa-circle-question" aria-hidden="true"></i> When Is SPN Registration Required?

You need SPNs when Windows authentication crosses a machine boundary, or when a service runs as a domain account:

* ✅ **Required** - NTLM is disabled (Kerberos-only policy)
* ✅ **Required** - <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> and SQL Server are on different machines
* ✅ **Required** - SQL Server runs as a domain account or gMSA
* ✅ **Required** - an IIS application pool runs as a domain account, for example the v7 [Web Client][], [Web API][], or [Log API][] published on a DNS alias
* ✅ **Required** - [Linked Servers][] connect to remote SQL Server instances, or another double-hop scenario needs [Trusted for delegation][]
* ✅ **Required** - SQL Server failover clusters or [Always On Availability Groups][AlwaysOn]
* ✅ **Required** - load-balanced IIS web farms serving the Web Client

You don't need to register SPNs yourself when:

* ❌ **Not required** - BizTalk, SQL Server, and <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> all run on one machine with built-in accounts
* ❌ **Not required** - you use SQL Server authentication instead of Windows authentication
* ❌ **Not required** - the IIS application pool uses ApplicationPoolIdentity or Network Service and users browse to the machine name; the computer account's built-in `HOST/` SPN covers it

<aside aria-label="Note" class="nodinite-note nodinite-note--note">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-note"></i> Note</p>
<div class="nodinite-note__content"><p>Even when all databases are on the same SQL Server instance, <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> requires <a href="https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/linked-servers/">Linked Servers</a> to be configured. SPNs only come into play when Windows authentication crosses machine boundaries.</p></div>
</aside>

### End-to-End Example: Multi-Tier Deployment with NTLM Disabled

The Web Client runs on an IIS server, the Monitoring and Logging Services on an application server, and SQL Server on a database server. NTLM is disabled. This deployment needs SPNs from **both** guides:

| SPN | Owner account | Covered in |
| --- | --- | --- |
| `HTTP/nodinite.contoso.com` | IIS application pool domain account | [HTTP SPNs for IIS][IIS HTTP SPN] |
| `HTTP/nodinite` | IIS application pool domain account | [HTTP SPNs for IIS][IIS HTTP SPN] |
| `MSSQLSvc/sql-prod-01.contoso.com` | SQL Server service account | [SQL Server SPNs][SQL Server SPN] |
| `MSSQLSvc/sql-prod-01.contoso.com:1433` | SQL Server service account | [SQL Server SPNs][SQL Server SPN] |
| More for named instances, clusters, listeners, and web farm nodes | As above | The matching guide |

<aside aria-label="Important" class="nodinite-note nodinite-note--important">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-message-exclamation"></i> Important</p>
<div class="nodinite-note__content"><p>In NTLM-disabled environments, every service that runs as a domain account needs its SPNs. Missing even one causes a hard authentication failure for that hop.</p></div>
</aside>

## <i class="fal fa-user-shield" aria-hidden="true"></i> Service Account Requirements

These rules apply to every account that owns an SPN, whether it runs SQL Server, an IIS application pool, or a Windows service.

| Requirement | Description |
| --- | --- |
| Domain account or gMSA | Use a dedicated Active Directory account or [gMSA][gMSA accounts], not `LocalSystem`, `NetworkService`, or `NT SERVICE\...`, for distributed Kerberos and delegation |
| SPN registration rights | Either the account may register its own SPNs, or a Domain Admin registers them manually |
| Not sensitive | **Account is sensitive and cannot be delegated** must not be checked in Active Directory when the account takes part in delegation |
| Trusted for delegation | Configure [Trusted for delegation][] for linked servers and other double hops |
| Log on as a service | Windows services need the [Logon as a Service right][] |

<aside aria-label="Important" class="nodinite-note nodinite-note--important">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-message-exclamation"></i> Important</p>
<div class="nodinite-note__content"><p>Registering SPNs for another account requires Domain Admin rights, or delegated rights to write <code>servicePrincipalName</code>. Work with your Active Directory administrators.</p></div>
</aside>

<aside aria-label="Important" class="nodinite-note nodinite-note--important">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-message-exclamation"></i> Important</p>
<div class="nodinite-note__content"><p><strong>Upgrades and migrations:</strong> if you upgrade or migrate an older <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> installation and a required SPN is missing, register it as part of the same change. Changes to service identities, server names, cluster names, listener names, or Web Client hostnames all change which SPNs you need.</p></div>
</aside>

## <i class="fal fa-terminal" aria-hidden="true"></i> Shared setspn Commands

Both guides use the same commands. They're listed once here; the guides show only the SPN values for their scenario.

| Task | Command |
| --- | --- |
| Register an SPN, after checking for duplicates | `setspn -S <serviceclass>/<host> <DOMAIN\account>` |
| List the SPNs on an account | `setspn -L <DOMAIN\account>` |
| Find which account owns an SPN | `setspn -Q <serviceclass>/<host>` |
| Find duplicate SPNs in the forest | `setspn -X` |
| Remove an SPN from an account | `setspn -D <serviceclass>/<host> <DOMAIN\account>` |
| Clear cached Kerberos tickets on a client before retesting | `klist purge` |
| Show cached Kerberos tickets on a client | `klist` |

```cmd
:: Register an SPN (SQL Server example)
setspn -S MSSQLSvc/sql-prod-01.contoso.com CONTOSO\svc-sql-prod

:: Verify
setspn -L CONTOSO\svc-sql-prod
```

**Expected result:**

```text
Registered ServicePrincipalNames for CN=svc-sql-prod,OU=Service Accounts,DC=Contoso,DC=com:
        MSSQLSvc/sql-prod-01.contoso.com:1433
        MSSQLSvc/sql-prod-01.contoso.com
```

<aside aria-label="Tip" class="nodinite-note nodinite-note--tip">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-lightbulb"></i> Tip</p>
<div class="nodinite-note__content"><p>Always use <code>setspn -S</code> rather than the older <code>setspn -A</code>. <code>-S</code> checks the forest for duplicates before adding the SPN.</p></div>
</aside>

### Error `0x21c7/8647`: SPN Value Is Not Unique Forest-Wide

If `setspn -S` returns:

```text
Failed to assign SPN ... error 0x21c7/8647
The operation failed because SPN value provided for addition/modification is not unique forest-wide.
```

Active Directory already has an owner for that SPN. To resolve it:

1. Find the owner with `setspn -Q <serviceclass>/<host>` for both the short name and the FQDN, and run `setspn -X` to list all duplicates.
2. If the owner is already the intended account, do nothing; the SPN is in place.
3. If the owner is a stale or wrong account, for example after a server or account migration, remove the SPN from that account with `setspn -D`, then add it to the correct account with `setspn -S`.

<aside aria-label="Warning" class="nodinite-note nodinite-note--warning">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-triangle-exclamation"></i> Warning</p>
<div class="nodinite-note__content"><p>For <code>HTTP/</code> SPNs on a machine-name URL, the conflict can come from the computer account's <code>HOST/</code> SPN even when <code>setspn -Q</code> shows no <code>HTTP/</code> row. Never remove <code>HOST/</code> SPNs from a computer account; see <a href="https://docs.nodinite.com/install-and-update/troubleshooting/iis/http-spn-for-iis/">HTTP SPN Ownership Conflicts</a> in the IIS guide.</p></div>
</aside>

## <i class="fal fa-gears" aria-hidden="true"></i> Other Services: BizTalk Host Instances

When BizTalk [Host Instances][] run as custom domain accounts and are accessed with Kerberos, register their SPNs with the same `setspn -S` pattern, substituting the host instance account and host name:

```cmd
setspn -S BTSSvc/biztalk-host01.contoso.com CONTOSO\svc-biztalk-host
```

<aside aria-label="Note" class="nodinite-note nodinite-note--note">
<p class="nodinite-note__label" aria-hidden="true"><i class="far fa-fw fa-note"></i> Note</p>
<div class="nodinite-note__content"><p>When you upgrade or migrate a BizTalk environment, validate SPN ownership in the same change window. A missing BizTalk SPN is often discovered only after a host instance moves or a server is renamed.</p></div>
</aside>

## <i class="fal fa-book" aria-hidden="true"></i> External References

* [Register a Service Principal Name for Kerberos Connections](https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/register-a-service-principal-name-for-kerberos-connections)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>
* [Understanding Kerberos Double Hop](https://learn.microsoft.com/en-us/archive/blogs/askds/understanding-kerberos-double-hop)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>
* [Microsoft Kerberos Configuration Manager for SQL Server](https://www.microsoft.com/en-us/download/details.aspx?id=39046)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>
* [Setspn command reference](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc731241(v=ws.11))<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-database" aria-hidden="true"></i> [SQL Server SPNs (MSSQLSvc)][SQL Server SPN]  
* <i class="fal fa-globe" aria-hidden="true"></i> [HTTP SPNs for IIS][IIS HTTP SPN]  
* <i class="fal fa-users" aria-hidden="true"></i> [Trusted for delegation][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-key" aria-hidden="true"></i> [Kerberos Transparent Login After v7 Upgrade][Kerberos Transparent Login]  
* <i class="fal fa-shield-halved" aria-hidden="true"></i> [NTLM vs Kerberos Authentication][]  
* <i class="fal fa-link" aria-hidden="true"></i> [Linked Servers][]  
* <i class="fal fa-server" aria-hidden="true"></i> [Always On Availability Groups][AlwaysOn]  
* <i class="fal fa-id-card" aria-hidden="true"></i> [gMSA accounts][]  
* <i class="fal fa-database" aria-hidden="true"></i> [Configuration Database][]  
* <i class="fal fa-database" aria-hidden="true"></i> [Log Databases][]  
* <i class="fal fa-database" aria-hidden="true"></i> [SQL Server Troubleshooting][SQL Server Overview]  

[AlwaysOn]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/always-on-availability-groups/
[Configuration Database]:https://docs.nodinite.com/core-services/configuration-database/overview/
[gMSA accounts]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/gmsa-accounts/
[Host Instances]:https://docs.nodinite.com/logging-and-monitoring/microsoft-biztalk-server-monitoring/features/host-instances/overview/
[IIS Authentication settings]:https://docs.nodinite.com/install-and-update/troubleshooting/iis/iis-authentication-settings/
[IIS HTTP SPN]:https://docs.nodinite.com/install-and-update/troubleshooting/iis/http-spn-for-iis/
[IIS Overview]:https://docs.nodinite.com/install-and-update/troubleshooting/iis/overview/
[Kerberos Transparent Login]:https://docs.nodinite.com/install-and-update/troubleshooting/iis/hardening/kerberos-transparent-login-after-v7-upgrade/
[Linked Servers]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/linked-servers/
[Log API]:https://docs.nodinite.com/core-services/log-api/overview/
[Log Databases]:https://docs.nodinite.com/core-services/log-databases/overview/
[Logging Service]:https://docs.nodinite.com/core-services/logging-service/overview/
[Login Prompt]:https://docs.nodinite.com/core-services/web-client/troubleshooting/login-prompt-you-for-a-password/
[Logon as a Service right]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/logon-as-a-service-right/
[MCP Endpoint]:https://docs.nodinite.com/core-services/mcp-endpoint/overview/
[Monitoring Service]:https://docs.nodinite.com/core-services/monitoring-service/overview/
[NTLM vs Kerberos Authentication]:https://docs.nodinite.com/install-and-update/troubleshooting/iis/ntlm-vs-kerberos-authentication/
[Pickup Service]:https://docs.nodinite.com/logging-and-monitoring/pickup-logevents-service/overview/
[SQL Server Overview]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/overview/
[SQL Server SPN]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/spn-for-sql-server/
[Trusted for delegation]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/trusted-for-delegation/
[Web API]:https://docs.nodinite.com/core-services/web-api/overview/
[Web Client]:https://docs.nodinite.com/core-services/web-client/overview/