r/SQLServer • u/Personal-Owl-888 • Jun 03 '26
Question SQL Server 2022 Availability Group works in Workgroup but fails in Active Directory environment
Hello everyone,
This is my first time posting on this forum, so please excuse me if I miss any forum conventions or provide too much or too little information.
I am currently learning SQL Server administration and I am doing a practical lab as part of my internship. I would appreciate some guidance regarding an issue I am facing with SQL Server 2022 Availability Groups.
Lab Context
I have built two separate labs to compare the behavior of SQL Server 2022 Availability Groups in different environments.
Lab 1 - Workgroup Environment
- Two Windows Server 2022 servers.
- One Primary replica.
- One Secondary replica.
- WSFC cluster created.
- Availability Group configured.
Lab 2 - Active Directory Environment
- Two Windows Server 2022 servers joined to an existing Active Directory domain.
- One Primary replica.
- One Secondary replica.
- WSFC cluster created.
- Availability Group configured.
In both labs, the primary server hosts the same SQL Server 2022 database.
Actions Performed
The following steps were successfully completed in both environments:
- Full backup of the database.
- Transaction Log backup.
- Restore of the database on the secondary replica using NORECOVERY.
The secondary database is currently in the RESTORING state, which is required before joining it to an Availability Group.
Results
Workgroup Lab
Everything works correctly:
- WSFC cluster created successfully.
- Availability Group created successfully.
- Secondary database joined the AG without issues.
- Data synchronization started successfully.
Active Directory Lab
The situation is different.
The following components appear to be working correctly:
- DNS resolution.
- Network communication.
- WSFC cluster.
- Availability Group creation.
- Communication between replicas.
- Cluster Name Object (CNO) exists in Active Directory.
- Required permissions appear to be configured.
- Availability Group Listener was created successfully and is visible in Active Directory Users and Computers (ADUC).
However, when I try to join the secondary database to the Availability Group, the operation fails.
The database remains in the RESTORING state and does not start synchronization.
My Question
What I find surprising is that the exact same procedure works perfectly in the Workgroup environment but fails in the Active Directory environment.
Since the following components seem to be functioning properly:
- Network
- DNS
- WSFC Cluster
- Availability Group
- Listener
- Replica communication
- Backup and restore process
What Active Directory-related factors could prevent the secondary database from joining the Availability Group?
I would also like to better understand how the SQL Server HADR (High Availability and Disaster Recovery) layer works in an Active Directory environment.
For example:
- What role do Kerberos authentication and SPNs play in HADR communication?
- Could SQL Server service account permissions be responsible for this behavior?
- What troubleshooting steps would you recommend when the Availability Group is created successfully, but the secondary database fails to join and synchronize?
Thank you in advance for your help and recommendations.
6
u/jdanton14 Microsoft MVP Jun 03 '26
Just ask the AI that wrote this.
You need an account that can create a computer object in an AD OU to create a Windows Server Failover Cluster in a domain. You then need to grant that computer account the permission to create a computer object (or have an admin pre create one for you) for your AG listener.
3
u/Appropriate_Lack_710 Jun 03 '26
What's the error message you're receiving?
1
u/Ill_Drag6021 1 Jun 04 '26 edited Jun 04 '26
What’s the error? error logs should help
HADR endpoints exist? are you able to telnet between the two boxes on HADR endpoint port? (default is 5022)
are the instances on the two replicas running under the same AD service account or different?