How to Set Up RDS Connection Broker on Windows Server 2012 R2
The RD Connection Broker is the central intelligence of a Remote Desktop Services deployment. It load-balances incoming connections across multiple RD Session Host servers, ensures users reconnect to their existing disconnected sessions rather than starting new ones, and manages the assignment of virtual desktops in VDI deployments. Without a Connection Broker, each user must manually select a Session Host, and there is no automatic reconnection to existing sessions. This guide covers installing, configuring, and making the Connection Broker highly available in Windows Server 2012 R2 RDS.
RD Connection Broker Functions
The RD Connection Broker provides the following services:
- Load balancing: Directs new connections to the Session Host with the fewest active sessions (or lowest weighted load)
- Session reconnection: Tracks which Session Host holds each user’s disconnected session and routes reconnection requests to that host
- RemoteApp management: Serves as the configuration store for Session Collections and published RemoteApp programs
- VDI assignment: Assigns pooled or personal virtual desktops to users in VDI deployments
- RD Web Access integration: Provides the application/desktop list to RD Web Access portals
Prerequisites
- Windows Server 2012 R2 domain-joined server
- Administrative privileges in the domain
- For high-availability Connection Broker: SQL Server (or SQL Express) for the Connection Broker database, plus a DNS round-robin or hardware load balancer
Step 1 — Install the RD Connection Broker Role
Install-WindowsFeature -Name RDS-Connection-Broker -IncludeManagementTools
The Connection Broker is typically installed as part of the full RDS deployment wizard. If adding it separately:
New-RDSessionDeployment -ConnectionBroker "rdcb.domain.com" -WebAccessServer "rdwa.domain.com" -SessionHost "rdsh01.domain.com"
Step 2 — Verify Connection Broker Status
# Check the Connection Broker service status:
Get-Service -ComputerName "rdcb.domain.com" -Name "Tssdis"
# Get Connection Broker deployment details:
Get-RDServer -ConnectionBroker "rdcb.domain.com" | Select-Object Server, Roles
Step 3 — Configure Load Balancing
The Connection Broker uses weighted round-robin load balancing by default. Configure weights for Session Hosts with different capacities (higher-weight servers receive more connections):
# View current Session Host load balancing settings:
Get-RDSessionHost -CollectionName "General Desktop" -ConnectionBroker "rdcb.domain.com" | Select-Object SessionHost, NewConnectionAllowed, SessionCount
# Set load balancing weight (1-100, default 1 = equal load):
# This is configured at the Session Host level per collection:
Load balancing is managed automatically by the Connection Broker. To prevent a server from receiving new connections (drain mode):
Set-RDSessionHost -CollectionName "General Desktop" -SessionHost "rdsh01.domain.com" -NewConnectionAllowed "No" -ConnectionBroker "rdcb.domain.com"
Step 4 — Configure the Connection Broker for High Availability
A single Connection Broker is a single point of failure. Windows Server 2012 R2 supports active-passive Connection Broker HA using a shared SQL Server database. To configure HA:
First, create a SQL Server database for the Connection Broker. The database name is typically RDCB-HA. Grant the Connection Broker computer account (DOMAINRDCB$) db_owner rights on the database.
Then configure the first Connection Broker for HA:
Set-RDConnectionBrokerHighAvailability -DatabaseConnectionString "DRIVER=SQL Server Native Client 11.0;SERVER=sql.domain.com;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;DATABASE=RDCB-HA" -DatabaseSecondaryConnectionString "DRIVER=SQL Server Native Client 11.0;SERVER=sql.domain.comSQLEXPRESS;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;DATABASE=RDCB-HA" -ClientAccessName "rdcb-ha.domain.com" -ConnectionBroker "rdcb.domain.com"
The -ClientAccessName is a DNS name that resolves to the active Connection Broker (managed via DNS round-robin or a load balancer). Create this DNS A record pointing to both Connection Broker server IPs.
Add additional Connection Broker servers to the HA group:
Add-RDServer -Server "rdcb02.domain.com" -Role "RDS-Connection-Broker" -ConnectionBroker "rdcb-ha.domain.com"
Step 5 — Verify HA Connection Broker
Get-RDConnectionBrokerHighAvailability -ConnectionBroker "rdcb-ha.domain.com"
The output shows all Connection Broker nodes and their HA status. One node will be active (primary) and others will be in standby.
Step 6 — Configure Session Reconnection
The Connection Broker tracks sessions and reconnects users to their existing disconnected session on the correct Session Host. Verify that session reconnection is working by:
- Connecting to an RDS session and disconnecting (do not log off)
- Reconnecting from a different client
- Verifying you reconnect to the same session on the same Session Host
Check sessions and which Session Host they reside on:
Get-RDUserSession -CollectionName "General Desktop" -ConnectionBroker "rdcb.domain.com" | Select-Object UserName, SessionState, HostServer, SessionId | Format-Table -AutoSize
Step 7 — Add the Connection Broker to the Session Broker Servers Group
The Connection Broker computer account must be a member of the RDS Endpoint Servers group in Active Directory for proper operation:
Import-Module ActiveDirectory
Add-ADGroupMember -Identity "RDS Endpoint Servers" -Members "rdcb$"
Step 8 — Monitor Connection Broker Events
# View recent Connection Broker events:
Get-WinEvent -ComputerName "rdcb.domain.com" -LogName "Microsoft-Windows-TerminalServices-SessionBroker/Admin" | Select-Object -First 20 TimeCreated, Id, Message | Format-List
Troubleshooting
Users not reconnecting to existing sessions: Verify the Session Hosts can communicate with the Connection Broker on TCP port 5985 (WinRM). Check that the Tssdis service is running on the Connection Broker.
HA Connection Broker database connection fails: Verify SQL Server connectivity, SQL Native Client installation on the Connection Broker servers, and database permissions for the Connection Broker computer accounts.
# Test WinRM connectivity from Session Host to Connection Broker:
Test-WSMan -ComputerName "rdcb.domain.com"
Summary
The RD Connection Broker is the backbone of a scalable RDS deployment on Windows Server 2012 R2. It provides transparent load balancing across Session Hosts, ensures user sessions are reconnected to the correct host after disconnection, and serves as the management plane for Session Collections and RemoteApp configurations. Configuring Connection Broker High Availability using SQL Server eliminates the single point of failure and ensures the RDS infrastructure remains operational even if one Connection Broker server is lost.