---
title: SQL Server Linked Servers – Configuration Guide for Nodinite Distributed Environments
description: Complete guide to configuring SQL Server Linked Servers for Nodinite. Learn about RPC settings, security contexts, Always On Availability Groups, failover clusters, and troubleshooting linked server connectivity.
---

# :fa-link: SQL Server Linked Servers

Master SQL Server Linked Server configuration for :Nodinite: distributed environments. This comprehensive guide covers linked server setup, RPC configuration, [Always On Availability Groups][AlwaysOn] (AOAG), failover clusters, security contexts, and troubleshooting common connectivity issues.

What you'll learn on this page:

✅ When linked servers are required for :Nodinite: deployments  
✅ Configure linked servers for default instances, named instances, clusters, and AOAG  
✅ Enable RPC and RPC Out for distributed transactions  
✅ Set up security contexts for Windows authentication  
✅ Troubleshoot common linked server connectivity and authentication issues  

## :fa-circle-info: Overview

**SQL Server Linked Servers** enable :Nodinite: to query databases across multiple SQL Server instances. The [Configuration Database][] uses linked servers to access [Log Databases][], BizTalk tracking databases, and other remote SQL resources. Even when databases reside on the same SQL Server instance, linked servers must be configured for :Nodinite: to function correctly.

### Which Nodinite Services Use Linked Servers?

Only specific :Nodinite: services access databases through linked servers:

* ✅ [Logging Service][] — Fetches log data from Log Databases and BizTalk tracking databases
* ✅ [Monitoring Service][] — Retrieves monitoring data from Log Databases
* ✅ [Log API][] — Accesses log data through linked servers
* ✅ [Web API][] — Queries databases through linked servers

>[!NOTE]
>The service accounts running these four services must have appropriate SQL Server permissions on all linked instances. See [Security Context: Passthrough Authentication](#security-context-passthrough-authentication) below for detailed requirements.

### What Is a Linked Server?

A linked server is a SQL Server object that allows you to execute queries against remote SQL Server instances (or other OLE DB data sources) as if they were local. :Nodinite: relies on linked servers to maintain a consistent architecture regardless of database distribution.

### Architecture Overview

<div class="mermaid">
graph TD
  subgraph "SQL Server Hotel"
    roLogDatabase2(fal:fa-database fal:fa-database fal:fa-database Log databases)
  end
  subgraph "Nodinite SQL Server Instance"
    roConfigDatabase(fal:fa-database Config Database) ---|"Linked Server"| roLogDatabase(fal:fa-database fal:fa-database fal:fa-database Log databases)
  end
  subgraph "BizTalk SQL Server"
    roBizTalkMGMTDB(fal:fa-database BizTalkMGMTDb)
  end
  subgraph BizTalk SQL Server 2
    roBizTalkDTADb(fal:fa-database BizTalkDTADb)
  end
  roConfigDatabase -.-|"Linked Server"| roLogDatabase2
  roConfigDatabase -.-|"Linked Server"| roBizTalkDTADb
  roConfigDatabase -.-|"Linked Server"| roBizTalkMGMTDB
</div>

*Diagram: the :Nodinite: [Configuration Database][] connects to local and historical ("SQL Server Hotel") [Log Databases][], and to the BizTalk databases read by the [BizTalk Server Logging Agent][BizTalk Logging], through Linked Servers configured with [RPC and RPC Out][LinkedServer - RPC - RPC OUT].*

### When Are Linked Servers Required?

* ✅ **Always** — Even when [Configuration Database][] and [Log Databases][] are on the same SQL Server instance
* ✅ [Configuration Database][] accessing [Log Databases][] on remote SQL Server instances
* ✅ [Configuration Database][] accessing BizTalk databases (BizTalkMGMTDb, BizTalkDTADb) for logging agents
* ✅ [Configuration Database][] accessing [Dynamics 365][] databases for monitoring
* ✅ Any scenario where :Nodinite: [Core Services][] query databases across SQL instances

### When Are Linked Servers Not Required?

* ❌ Never — Linked servers are **always required** for :Nodinite: to function, regardless of database distribution

>[!IMPORTANT]
>Even when all databases are on the same SQL Server instance, :Nodinite: requires linked server objects to maintain a consistent data access architecture. This design ensures :Nodinite: can seamlessly scale from single-instance to distributed environments without code changes.

## :fa-toolbox: Configuration Requirements

### Core Linked Server Settings

All linked server configurations for :Nodinite: must have:

1. **Server name** — Exact name of the SQL Server instance (see [Naming Conventions](#fa-network-wired-naming-conventions) below)
2. **Security context** — "Be made using the login's current security context" (passthrough authentication)
3. **RPC enabled** — `rpc = true`
4. **RPC Out enabled** — `rpc out = true`

>[!IMPORTANT]
>These settings enable :Nodinite: to execute remote stored procedures across linked servers. Without them, distributed transactions and Core Services operations will fail. See [About Linked Server RPC and RPC OUT option][LinkedServer - RPC - RPC OUT] for details.

### Security Context: Passthrough Authentication

:Nodinite: uses **passthrough authentication** where the [Logging Service][], [Monitoring Service][], and other [Core Services][] maintain the identity of their service account when traversing linked servers.

**Configuration:** "Be made using the login's current security context"

#### Benefits

* ✅ Consistent security model across all linked servers
* ✅ Windows Integrated Security with Kerberos authentication
* ✅ No need to store SQL credentials in linked server definitions
* ✅ Centralized service account management

#### Requirements

* ✅ Service accounts must have SQL Server login rights on all linked instances
* ✅ [Trusted for delegation][] configured for multi-hop authentication
* ✅ [Service Principal Names (SPN)][SPN] registered for Kerberos
* ✅ Firewall ports open (see [SQL Server Firewall Configuration][SQL Firewall])

>[!NOTE]
>Using SQL Server in mixed mode allows you to impersonate a Windows account with a SQL account, bypassing Kerberos-related problems. We urge you to only use this solution as a **temporary workaround** until you have resolved your Kerberos-related issues. Windows authentication with Kerberos is the recommended production configuration.

## :fa-code: Creating Linked Servers

### SQL Script Template

Use the following template to create a linked server (replace `%SERVER\INSTANCE%` with your actual server name):

```sql
-- Add the linked server
EXEC sp_addlinkedserver @server = '%SERVER\INSTANCE%';

-- Enable RPC
EXEC sp_serveroption '%SERVER\INSTANCE%', 'rpc', true;

-- Enable RPC Out
EXEC sp_serveroption '%SERVER\INSTANCE%', 'rpc out', true;
```

>[!IMPORTANT]
>On SQL Server 2022 and later, the default provider for a new linked server, `MSOLEDBSQL`, encrypts the connection and validates the SQL Server certificate. If the instance has no certificate the server trusts, add `@provider = N'MSOLEDBSQL'` and `@provstr = N'TrustServerCertificate=Yes;Encrypt=Yes'` to `sp_addlinkedserver`. After a move or in-place upgrade to a newer SQL Server, drop and recreate the existing linked servers, as described in [Recreate Linked Servers After a SQL Server Upgrade][Recreate Linked Servers].

### Examples

#### Default Instance (localhost)

```sql
EXEC sp_addlinkedserver @server = 'LOCALHOST';
EXEC sp_serveroption 'LOCALHOST', 'rpc', true;
EXEC sp_serveroption 'LOCALHOST', 'rpc out', true;
```

#### Named Instance (localhost)

```sql
EXEC sp_addlinkedserver @server = 'LOCALHOST\BIZTALK';
EXEC sp_serveroption 'LOCALHOST\BIZTALK', 'rpc', true;
EXEC sp_serveroption 'LOCALHOST\BIZTALK', 'rpc out', true;
```

#### Remote Server (Default Instance)

```sql
EXEC sp_addlinkedserver @server = 'SQL-PROD-01';
EXEC sp_serveroption 'SQL-PROD-01', 'rpc', true;
EXEC sp_serveroption 'SQL-PROD-01', 'rpc out', true;
```

#### Remote Server (Named Instance)

```sql
EXEC sp_addlinkedserver @server = 'SQL-PROD-01\BIZTALK';
EXEC sp_serveroption 'SQL-PROD-01\BIZTALK', 'rpc', true;
EXEC sp_serveroption 'SQL-PROD-01\BIZTALK', 'rpc out', true;
```

>[!TIP]
>After creating a linked server in SQL Server Management Studio (SSMS), you should be able to expand the linked server node and see the list of databases available on the remote instance.

![SSMS Object Explorer with a linked server expanded to show the remote databases][png_LinkedServer]  
*Example of a linked server in SSMS, expanded to list the databases on the remote instance.*  

## :fa-network-wired: Naming Conventions

The linked server name must match the SQL Server instance name format. Use the following conventions based on your environment:

:Nodinite: reads the Linked Server name it uses from the `LinkedServerName` property of the [SqlServer][] [System Parameter][System Parameters], so the Linked Server you create must have exactly that name.

### Default Instance

|**Environment**|**Linked Server Name**|  
|---|---|  
|Stand Alone|`localhost` OR `ServerName`|  
|Fail-Over Cluster|`localhost` OR `ClusterName`|  
|Always On (AOAG)|`ListenerName`|  

### Named Instance

|**Environment**|**Linked Server Name**|  
|---|---|  
|Stand Alone|`localhost\instancename` OR `ServerName\instancename`|  
|Fail-Over Cluster|`localhost\instancename` OR `ClusterName\instancename`|  
|Always On (AOAG)|`ListenerName\instancename`|  

>[!IMPORTANT]
>Always On Availability Groups require using the **listener name**, not individual node names, to ensure seamless failover.

## :fa-shield-check: Always On Availability Groups (AOAG)

If your SQL Server environment is configured with [Always On Availability Groups][AlwaysOn], additional configuration is **required** for linked servers.

### Listener Names

**Always use the AOAG listener name** when creating linked servers for availability group databases. This ensures connections automatically fail over to the active replica without manual intervention.

#### Example

```sql
-- Correct: Use listener name
EXEC sp_addlinkedserver @server = 'SQL-AOAG-Listener';

-- Incorrect: Don't use individual node names
-- EXEC sp_addlinkedserver @server = 'SQL-Node-01';
```

### SQL Accounts Are Not Replicated

>[!WARNING]
>**SQL logins are not replicated between AOAG nodes.** You must manually create SQL Server login accounts on each node in the availability group. Windows authentication with domain accounts is strongly recommended to avoid this issue.

### SPN Configuration for AOAG

Proper [Service Principal Names (SPN)][SPN] registration is critical for Always On Availability Groups. You must register SPNs for:

* ✅ AOAG listener name (with and without port)
* ✅ Each physical node name (with instance port)
* ✅ Each instance name on each node

>[!TIP]
>See the [Service Principal Names (SPN)][SPN] page for AOAG-specific SPN requirements including listener names, node names, and port configurations. The guide includes complete registration examples for two-node and multi-node AOAG clusters.

### DNS Suffix Considerations

>[!IMPORTANT]
>If you are using a **DNS suffix** in your environment (e.g., `server.contoso.com`), you may need to create **duplicate linked servers** with both short names and fully qualified domain names (FQDNs):
>
>```sql
>-- Short name
>EXEC sp_addlinkedserver @server = 'SQL-AOAG-Listener';
>
>-- FQDN with DNS suffix
>EXEC sp_addlinkedserver @server = 'SQL-AOAG-Listener.contoso.com';
>```

## :fa-fire: Failover Clusters

If your SQL Server environment is configured with failover clustering, you need to review the following additional requirements:

### Cluster Name vs. Node Names

**Use the cluster virtual network name** when creating linked servers, not individual node names. This ensures connections work regardless of which node currently owns the SQL Server resource.

#### Example

```sql
-- Correct: Use cluster name
EXEC sp_addlinkedserver @server = 'SQL-Cluster';

-- Incorrect: Don't use individual node names
-- EXEC sp_addlinkedserver @server = 'SQL-Node-01';
```

### MSDTC Configuration

Failover clusters require special [Microsoft Distributed Transaction Coordinator (MSDTC)][MSDTC] configuration to support distributed transactions across cluster nodes.

>[!IMPORTANT]
>You must configure [MSDTC][] as a clustered resource. See the [MSDTC][MSDTC] guide for detailed cluster configuration steps.

### Linked Servers on Each Node

>[!IMPORTANT]
>If you have remote databases (BizTalk BizTalkDTADb, BizTalk BizTalkMGMTDb, and :Nodinite: Log Databases), you will need to add a linked server to every remote SQL instance **on each node** of the failover cluster.

## :fa-list-check: Required Linked Servers for Nodinite

Before installing :Nodinite:, a SQL DBA must create the following linked servers on the [Configuration Database][] SQL instance:

### Core Services (Always Required)

1. **Configuration Database → Local Log Databases** — Even when on same instance
2. **Configuration Database → Remote Log Databases** — If Log Databases on different SQL instance(s)

### BizTalk Logging Agents

If using the :Nodinite: [BizTalk Server Logging Agent][BizTalk Logging] to log BizTalk Server events:

1. **Configuration Database → BizTalk Management Database (BizTalkMGMTDb)**
2. **Configuration Database → BizTalk Tracking Database (BizTalkDTADb)**

>[!NOTE]
>If BizTalkMGMTDb and BizTalkDTADb are on different SQL Server instances, create separate linked servers for each.

### Dynamics 365 Monitoring

If using the :Nodinite: [Dynamics 365 Monitoring Agent][Dynamics 365] to monitor Dynamics 365:

1. **Configuration Database → Dynamics 365 Database(s)**

### Custom Integrations

If using :Nodinite: to monitor custom databases:

1. **Configuration Database → Custom Application Databases** (as needed)

## :fa-wrench: Troubleshooting

### Common Issues

|**Issue**|**Cause**|**Solution**|  
|---|---|---|  
|"RPC remote procedure call" error|RPC or RPC Out not enabled|Verify `sp_serveroption` for both `rpc` and `rpc out` set to `true`|  
|"Cannot generate SSPI context"|Missing or duplicate SPNs|See [SPN troubleshooting][SPN] guide|  
|"Anonymous login" errors|Delegation not configured|See [Trusted for delegation][] guide|  
|Linked server fails after AOAG failover|Using node name instead of listener|Recreate linked server using AOAG listener name|  
|Timeout connecting to linked server|Firewall blocking ports|See [SQL Server Firewall Configuration][SQL Firewall]|  
|"The certificate chain was issued by an authority that is not trusted", or linked server fails after a SQL Server upgrade|Old provider or options, or encryption without a trusted certificate|[Recreate the linked server with encryption][Recreate Linked Servers]|  
|"Login failed for user"|Service account lacks SQL rights|Grant appropriate database roles on remote instance|  

### Testing Linked Server Connectivity

**Test a linked server query:**

```sql
-- Test basic connectivity
SELECT @@SERVERNAME AS LinkedServerName;

-- Test through linked server (replace LINKEDSERVERNAME)
SELECT * FROM [LINKEDSERVERNAME].[master].[sys].[databases];

-- Test RPC is enabled
EXEC sp_helpserver;
```

**Expected output for `sp_helpserver`:**

The `rpc` and `rpc out` columns should show `true` for the linked server.

### Validation Checklist

After creating linked servers, verify:

* ✅ Linked server appears in SSMS under **Server Objects → Linked Servers**
* ✅ Can expand linked server to see remote database list
* ✅ `sp_helpserver` shows `rpc` and `rpc out` = `true`
* ✅ Test query returns results without errors
* ✅ Service account has login rights on remote SQL instance
* ✅ [Trusted for delegation][] configured (for distributed environments)
* ✅ [SPNs][SPN] registered (for distributed environments)
* ✅ [Firewall ports][SQL Firewall] open between SQL instances

## :fa-diagram-project: Data Flow Architecture

Understanding how :Nodinite: uses linked servers helps troubleshoot connectivity issues. The [Architecture Overview](#architecture-overview) above shows the linked servers between the databases; this diagram adds the [Core Services][] that call the Configuration Database:

<div class="mermaid">
graph LR
  subgraph "SQL Server"
    roConfigDatabase(fal:fa-database Config Database) ---|"Linked Server"| roLogDatabase(fal:fa-database fal:fa-database fal:fa-database Log databases)
  end
  subgraph "Application Server"
    roLogAPI(fal:fa-cloud-arrow-down Log API) ---|"SQL, DTC, DNS, RPC"| roConfigDatabase
    roWebAPI(fal:fa-cloud Web API)
    roWebAPI ---|"SQL, DTC, DNS, RPC"| roConfigDatabase
    roLoggingService(fal:fa-hard-drive Logging Service) ---|"SQL, DTC, DNS, RPC"| roConfigDatabase
    roMonitoringService(fal:fa-watch-fitness Monitoring Service) ---|"SQL, DTC, DNS, RPC"| roConfigDatabase
  end
</div>

*Diagram: the :Nodinite: [Log API][], [Web API][], [Logging Service][], and [Monitoring Service][] (each its own [IIS][] web site on Windows Server) access the [Configuration Database][], which uses Linked Servers to query the [Log Databases][]. The ports for each hop are on the [SQL Server Firewall Configuration][SQL Firewall] page.*

## :fa-book: Related Guides

### Prerequisites and Configuration

* [Configuration Database Prerequisites][ConfigDB Prerequisites]
* [Log Database Prerequisites][LogDB Prerequisites]
* [SQL Server Connection Strings][SQL Connection Strings]
* [SQL Server Firewall Configuration][SQL Firewall]

### Security and Authentication

* [Service Principal Names (SPN)][SPN] — Kerberos authentication for linked servers
* [Trusted for delegation][] — Multi-hop authentication configuration
* [MSDTC][] — Distributed transaction coordinator

### Advanced Scenarios

* [Always On Availability Groups][AlwaysOn] — AOAG-specific configuration
* [Linked Server RPC and RPC OUT option][LinkedServer - RPC - RPC OUT] — Deep dive into RPC settings

## :fa-hand-point-right: Next Steps

* :fa-key: [Service Principal Names (SPN)][SPN]  
* :fa-user-shield: [Trusted for delegation][]  
* :fa-server: [Always On Availability Groups][AlwaysOn]  
* :fa-plug: [Linked Server RPC and RPC OUT option][LinkedServer - RPC - RPC OUT]  

## :fa-link-horizontal: Related Topics

* :fa-database: [SQL Server Troubleshooting][SQL Server Overview]  
* :fa-truck-moving: [SQL Server Database Migration][Database Migration Overview] — Recreate linked servers after a move or SQL Server upgrade  
* :fa-database: [Configuration Database][]  
* :fa-database: [Log Databases][]  
* :fa-plug: [SQL Server Connection Strings][SQL Connection Strings]  
* :fa-shield-check: [SQL Server Firewall Configuration][SQL Firewall]  
* :fa-arrows-rotate: [MSDTC][]  
* :fa-rocket: [Nodinite Installation][Install]  
* :fa-sliders: [SqlServer][] System Parameter  

[AlwaysOn]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Always%20On%20Availability%20Groups.md
[BizTalk Logging]:{ndr}/Logging%20and%20Monitoring/Microsoft%20BizTalk%20Server%20-%20Logging/Overview.md
[ConfigDB Prerequisites]:{ndr}/Core%20Services/Configuration%20Database/Getting%20started/1.%20Prerequisites.md
[Configuration Database]:{ndr}/Core%20Services/Configuration%20Database/Overview.md
[Core Services]:{ndr}/Core%20Services/Overview.md
[Database Migration Overview]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Database%20Migration/Overview.md
[Dynamics 365]:{ndr}/Logging%20and%20Monitoring/Microsoft%20Dynamics%20365/Overview.md
[IIS]:{ndr}/Install%20and%20Update/Troubleshooting/IIS/Overview.md
[Install]:{ndr}/Install%20and%20Update/Overview.md
[LinkedServer - RPC - RPC OUT]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Linked%20Server%20RPC%20and%20RPC%20Out.md
[Log API]:{ndr}/Core%20Services/Log%20API/Overview.md
[Log Databases]:{ndr}/Core%20Services/Log%20Databases/Overview.md
[LogDB Prerequisites]:{ndr}/Core%20Services/Log%20Databases/Getting%20started/1.%20Prerequisites.md
[Logging Service]:{ndr}/Core%20Services/Logging%20Service/Overview.md
[Monitoring Service]:{ndr}/Core%20Services/Monitoring%20Service/Overview.md
[MSDTC]:{ndr}/Install%20and%20Update/Troubleshooting/Windows/Transactions%20MSDTC.md
[png_LinkedServer]:{ndm}/Documentation%20Pictures/LogAgent/BizTalk/LinkedServerSQLMMC.png
[Recreate Linked Servers]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Database%20Migration/Overview.md#fa-link-recreate-linked-servers-after-a-sql-server-upgrade
[SPN]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/SPN%20for%20SQL%20Server.md
[SQL Connection Strings]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Connection%20Strings.md
[SQL Firewall]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Firewall.md
[SQL Server Overview]:{ndr}/Install%20and%20Update/Troubleshooting/SQL%20Server/Overview.md
[SqlServer]:{ndr}/Administration/5.%20Settings/5.%20System%20Parameters/SqlServer.md
[System Parameters]:{ndr}/Administration/5.%20Settings/5.%20System%20Parameters/Overview.md
[Trusted for delegation]:{ndr}/Install%20and%20Update/Troubleshooting/Windows/Trusted%20for%20delegation.md
[Web API]:{ndr}/Core%20Services/Web%20API/Overview.md