---
title: SQL Server SPNs (MSSQLSvc) – Kerberos for Nodinite Databases and Linked Servers
description: Register and validate SQL Server SPNs (MSSQLSvc) for Nodinite. Covers default and named instances, ports, failover clusters, Always On listeners, linked server delegation, moving off built-in SQL accounts, and the Kerberos Configuration Manager.
---

# <i class="fal fa-database" aria-hidden="true"></i> SQL Server SPNs (MSSQLSvc): Kerberos for Nodinite Databases and Linked Servers

When a <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> service connects to SQL Server with Windows authentication, it asks Active Directory for a Kerberos ticket for an `MSSQLSvc/...` SPN. When the [Configuration Database][] then queries a remote [Log Database][Log Databases] through a [Linked Server][Linked Servers], SQL Server has to forward that identity in a second hop. If an SPN is missing, duplicated, or on the wrong account, you see:

* **"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, the [Web API][], or the CLI that [installs][Install Nodinite v7] or [updates][Updating Nodinite v7] <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> connects to SQL Server
* **"Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'"** on linked server queries
* Kerberos that works on one cluster node, or before a failover, and fails afterwards

This guide covers the SQL Server side of SPNs. For browser and [Web Client][] authentication, see [HTTP SPNs for IIS][IIS HTTP SPN]. For the concepts, the shared `setspn` commands, and the service account rules both sides share, see the [SPN hub][SPN].

## <i class="fal fa-network-wired" aria-hidden="true"></i> Understanding SQL Server Kerberos in Nodinite

SQL Server SPNs are about **service-to-service** authentication. Users never connect to SQL Server directly; <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> services do, and SQL Server itself becomes a client when it follows a linked server.

<div class="mermaid">
sequenceDiagram
  opt Kerberos TGT
    Logging Service ->> Domain Controller: Service account credentials
    Domain Controller ->> Logging Service: Kerberos TGT
  end
  opt Service ticket
    Logging Service ->> Domain Controller: Send TGT to request a ticket for MSSQLSvc/sql-config
    Domain Controller ->> Logging Service: Service ticket
  end
  Logging Service ->> SQL (Configuration Database): Client TGT and service ticket
  opt Delegated service ticket
    SQL (Configuration Database) ->> Domain Controller: Client TGT to request a ticket for MSSQLSvc/sql-log
    Domain Controller ->> SQL (Configuration Database): Service ticket
  end
  SQL (Configuration Database) ->> Remote SQL (Log Database): Client TGT and SQL service ticket
  Remote SQL (Log Database) ->> SQL (Configuration Database): Response
  SQL (Configuration Database) ->> Logging Service: Response
</div>

*Sequence: the [Logging Service][] authenticates to the [Configuration Database][], which uses [delegation][Trusted for delegation] to reach a remote Log Database through a linked server. Each SQL Server instance needs its own MSSQLSvc SPN.*

### Key Components Explained

| Component | Role | Requirement |
| --- | --- | --- |
| SQL Server service account | Owns the `MSSQLSvc` SPNs and decrypts incoming tickets | Domain account or [gMSA][gMSA accounts] for distributed Kerberos |
| `MSSQLSvc` [SPN][] | Identifies one SQL Server instance by host, port, or instance name | One per name clients use, on the SQL service account |
| [Linked server][Linked Servers] | Lets the [Configuration Database][] query [Log Databases][] on other instances | Configured with "be made using the login's current security context" |
| Delegation | Lets the [Configuration Database][] SQL Server forward the caller's identity | [Trusted for delegation][] on the SQL service account |
| Cluster and [listener][AlwaysOn] names | Virtual names clients use to reach the active node | Their own SPNs, in addition to each node |

### MSSQLSvc SPN Formats

| Format | When the client builds it |
| --- | --- |
| `MSSQLSvc/host.domain.com` | Default instance, TCP, port not specified |
| `MSSQLSvc/host.domain.com:1433` | Default instance, or any instance on a known TCP port |
| `MSSQLSvc/host.domain.com:InstanceName` | Named instance, resolved through SQL Server Browser or named pipes |
| `MSSQLSvc/host` and the variants above | Clients that connect with the NetBIOS short name |

## <i class="fal fa-code-compare" aria-hidden="true"></i> Built-In Account vs Domain Account

Many SQL Server installations start with a built-in virtual account such as `NT SERVICE\MSSQLSERVER` (default instance) or `NT SERVICE\MSSQL$<InstanceName>` (named instance). That account registers SPNs on the **computer account**, which works for local or single-hop scenarios but not for distributed Kerberos and delegation.

| Scenario | Built-in SQL account | Recommended action |
| --- | --- | --- |
| Single server, no linked servers, NTLM allowed | Often works | Keep temporarily if the risk is acceptable |
| <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> distributed across servers | High risk of Kerberos and SSPI issues | Move SQL Server to a domain account or gMSA |
| Linked servers or double-hop authentication | Not suitable for constrained delegation | Move SQL Server to a domain account or gMSA |
| NTLM disabled (Kerberos-only policy) | Commonly fails in production topologies | Move SQL Server to a domain account or gMSA before go-live |

<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>Treat a built-in SQL service account (<code>NT SERVICE\...</code>, <code>LocalSystem</code>, <code>NetworkService</code>) as a transition state. For production <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> deployments with linked servers, delegation, BizTalk, or Kerberos-only policies, run SQL Server as a dedicated <strong>domain account or gMSA</strong>.</p></div>
</aside>

## <i class="fal fa-clipboard-check" aria-hidden="true"></i> What You Need Before Starting

* The SQL Server service account for every instance <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> uses, from **SQL Server Configuration Manager**
* Every name clients use to reach each instance: server names, cluster virtual names, Always On listener names, and the ports
* Domain Admin rights, or an Active Directory administrator who can run `setspn`
* The [service account requirements][SPN] in the hub: domain account or gMSA, not marked sensitive, delegation configured where needed
* Firewall ports open between the servers, see [SQL Server Firewall Configuration][SQL Firewall]

## <i class="fal fa-terminal" aria-hidden="true"></i> Register MSSQLSvc SPNs

The `setspn` flags (`-S`, `-L`, `-Q`, `-X`, `-D`) are described once in the [SPN hub][SPN]. This section shows only the SQL Server SPN values.

### Default Instance

```cmd
setspn -S MSSQLSvc/sql-prod-01.contoso.com CONTOSO\svc-sql-prod
setspn -S MSSQLSvc/sql-prod-01.contoso.com:1433 CONTOSO\svc-sql-prod
```

### Named Instance

```cmd
setspn -S MSSQLSvc/sql-prod-01.contoso.com:BIZTALK CONTOSO\svc-sql-biztalk
setspn -S MSSQLSvc/sql-prod-01.contoso.com:50123 CONTOSO\svc-sql-biztalk
```

<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>If several named instances on the same server run as different service accounts, register each instance's SPNs on its own account.</p></div>
</aside>

### Verify the Registration

```cmd
setspn -L CONTOSO\svc-sql-prod
```

Confirm that every host, port, and instance variant appears on the SQL Server service account and on no other account.

## <i class="fal fa-diagram-project" aria-hidden="true"></i> SPN Requirements by Scenario

### Single Nodinite Instance on One Machine

The [Configuration Database][] and [Log Databases][] are on one SQL Server instance, on the same machine as <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span>.

* **Built-in SQL account:** no SPNs to register manually.
* **Domain account:** register the default instance SPNs shown above.

### Nodinite with a BizTalk Failover Cluster

<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> uses a standalone SQL Server; BizTalk uses a two-node failover cluster with a default and a named instance. You need **7** SPN registrations:

1. SQL Server name for the default instance with the <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> [Configuration Database][]
2. **First** node name for the default instance with the BizTalk databases
3. **Second** node name for the default instance with the BizTalk databases
4. **Cluster** name for the default instance with the BizTalk databases
5. **First** node name for the named instance with the BizTalk MessageBox database
6. **Second** node name for the named instance with the BizTalk MessageBox database
7. **Cluster** name for the named instance with the BizTalk MessageBox database

<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>Each physical node <strong>and</strong> the cluster virtual name need SPNs, or Kerberos breaks after a failover.</p></div>
</aside>

### Always On Availability Groups (AOAG)

With [Always On Availability Groups][AlwaysOn], register SPNs for the listener name and for each node. Even when the instances use a custom port (for example 50123), the listener typically uses port **1433**, so you need SPNs for both ports.

```cmd
setspn -S MSSQLSvc/AOAGListener:1433 CONTOSO\svc-sql-aoag
setspn -S MSSQLSvc/AOAGListener CONTOSO\svc-sql-aoag
setspn -S MSSQLSvc/NodeA:50123 CONTOSO\svc-sql-aoag
setspn -S MSSQLSvc/NodeB:50123 CONTOSO\svc-sql-aoag
setspn -S MSSQLSvc/NodeA:InstanceName CONTOSO\svc-sql-aoag
setspn -S MSSQLSvc/NodeB:InstanceName CONTOSO\svc-sql-aoag
```

Verify with `setspn -L CONTOSO\svc-sql-aoag`.

**Expected result:**

```text
MSSQLSvc/AOAGListener:1433
MSSQLSvc/AOAGListener
MSSQLSvc/NodeA:50123
MSSQLSvc/NodeB:50123
MSSQLSvc/NodeA:InstanceName
MSSQLSvc/NodeB:InstanceName
```

<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>Every replica must run as the same SQL Server service account for the listener SPN to work on all nodes, and each node needs the SQL logins configured locally. See <a href="https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/always-on-availability-groups/">Always On Availability Groups</a>.</p></div>
</aside>

## <i class="fal fa-link" aria-hidden="true"></i> Linked Servers and Delegation

<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> uses [Linked Servers][] to reach [Log Databases][] from the [Configuration Database][]. When they're on different SQL Server instances, the linked server query is a Kerberos double hop, and it needs all of these:

* ✅ **SPNs** - registered for every SQL Server instance in the chain
* ✅ **Delegation** - [Trusted for delegation][] configured on the Configuration Database SQL Server service account
* ✅ **Not sensitive** - the service account isn't marked **Account is sensitive and cannot be delegated**
* ✅ **Firewall** - ports open between the instances, see [SQL Server Firewall Configuration][SQL Firewall]
* ✅ **Linked server security** - configured as described in [Linked Servers][]

If any of these is missing, the remote instance receives the connection as `NT AUTHORITY\ANONYMOUS LOGON`.

## <i class="fal fa-arrows-rotate" aria-hidden="true"></i> Move SQL Server from a Built-In Account to a Domain Account

If SQL Server runs as `NT SERVICE\MSSQLSERVER` or another built-in account:

1. Create a dedicated Active Directory service account or [gMSA][gMSA accounts] for the SQL Server instance.
2. Grant it the [Logon as a Service right][] on the SQL Server host.
3. Change the service identity in **SQL Server Configuration Manager**.
4. Restart SQL Server in a maintenance window.
5. Register SPNs for every node, cluster, and listener name on the new account, and remove any stale ones from the computer account or old account.
6. Validate with the Kerberos Configuration Manager and `setspn -L`.
7. Re-test linked servers and every <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> authentication path.

<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>When 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, do this as part of the upgrade. Older installations often break when service identities, SQL Server names, or cluster and listener names change.</p></div>
</aside>

## <i class="fal fa-screwdriver-wrench" aria-hidden="true"></i> Validate with Microsoft Kerberos Configuration Manager

The [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> is the recommended tool for finding and fixing SQL Server SPN problems:

* ✅ **Detects** missing and duplicate SPNs
* ✅ **Validates** delegation settings
* ✅ **Generates** scripts that Domain Admins can run to fix issues
* ✅ **Runs locally** on the SQL Server host, without connection details

### SPN Tab

Every <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> SQL Server instance that takes part in a linked server hop should be listed in the **SPN** tab with status **OK**.

![Kerberos Configuration Manager SPN tab listing SQL Server SPNs with status OK][png_SPN]  
*All SQL Server instances in the linked server chain show their SPNs with status OK.*  

### Delegation Tab

The **Delegation** tab should report no issues.

![Kerberos Configuration Manager Delegation tab reporting no issues][png_Delegation]  
*No delegation issues reported for the SQL Server service account.*  

## <i class="fal fa-table" aria-hidden="true"></i> Common SQL Server SPN Issues

| Issue | Cause | Solution |
| --- | --- | --- |
| "Cannot generate SSPI context" | Missing or duplicate `MSSQLSvc` SPN | Run Kerberos Configuration Manager; register or remove SPNs |
| `NT AUTHORITY\ANONYMOUS LOGON` on linked servers | Delegation not configured, or SPN missing on one instance | Register SPNs for every instance; configure [Trusted for delegation][] |
| SQL Server connections fall back to NTLM | SPN not registered for the name or port the client used | Register SPNs for every node, cluster, listener, port, and instance name |
| Kerberos works on node A, fails on node B | SPNs registered for the cluster but not for each node | Register SPNs for each physical node |
| Kerberos fails after an Always On failover | Listener SPN missing, or replicas run as different accounts | Register the listener SPN; run all replicas as the same account |
| `setspn -S` returns `0x21c7/8647` | SPN already owned by another account | See the duplicate SPN section in the [SPN hub][SPN] |
| SPN registration errors in the SQL Server error log | Service account can't register its own SPNs | A Domain Admin registers them, see [Microsoft's SPN registration guide](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> |

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

* <i class="fal fa-users" aria-hidden="true"></i> [Trusted for delegation][]  
* <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-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-key" aria-hidden="true"></i> [Service Principal Names (SPN) hub][SPN]  
* <i class="fal fa-globe" aria-hidden="true"></i> [HTTP SPNs for IIS][IIS HTTP SPN]  
* <i class="fal fa-fire" aria-hidden="true"></i> [SQL Server Firewall Configuration][SQL Firewall]  
* <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/
[IIS HTTP SPN]:https://docs.nodinite.com/install-and-update/troubleshooting/iis/http-spn-for-iis/
[Install Nodinite v7]:https://docs.nodinite.com/install-and-update/getting-started/version-7/install-nodinite-v7/
[Linked Servers]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/linked-servers/
[Log Databases]:https://docs.nodinite.com/core-services/log-databases/overview/
[Logging Service]:https://docs.nodinite.com/core-services/logging-service/overview/
[Logon as a Service right]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/logon-as-a-service-right/
[png_Delegation]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/IMUpdate/Troubleshooting/TrustedForDelegation_NoIssues.png
[png_SPN]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/IMUpdate/Troubleshooting/Kerberos_SPN.png
[SPN]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/spn/
[SQL Firewall]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/firewall/
[SQL Server Overview]:https://docs.nodinite.com/install-and-update/troubleshooting/sql-server/overview/
[Trusted for delegation]:https://docs.nodinite.com/install-and-update/troubleshooting/windows/trusted-for-delegation/
[Updating Nodinite v7]:https://docs.nodinite.com/install-and-update/getting-started/version-7/updating-nodinite-v7/
[Web API]:https://docs.nodinite.com/core-services/web-api/overview/
[Web Client]:https://docs.nodinite.com/getting-started/overview/