SQL AlwaysOn: Failed to join the database to the Availability Group (Error 35250)

[Updated on 5/16/2017] Alternate solution for fix# 2

You might get this particular error "Failed to join the database to the Availability Group (Error 35250)" when you are creating a new Availability Group (AG) and initiated a Full sync which basically copies the backup and attaches the DBs on the replica servers. You will see tin he New AG Wizard that the 'joining to the database to the availability group" stage keeps on spinning for a while before it gives up and shows this error.

There are good number of reason for this to fail. There are primarily two possible causes:

1. Firewall blocking the port (5022 by default) that is used for communication between primary and secondary replicas of the AG.

2. Incorrect permissions on the mirroring end point on the SQL servers

Here is a msdn article that mentions the resolution based on the above: http://msdn.microsoft.com/en-us/library/ff878308.aspx#JoinDbFails

To fix #1 just add a firewall inbound rule to allow communications on the AG port (default 5022). Follow this link for detailed steps: http://technet.microsoft.com/en-us/library/ms175043.aspx

To fix #2, read on:

Here is a good post on this topic: http://blogs.msdn.com/b/alwaysonpro/archive/2013/12/09/trouble-shoot-error.aspx. This article discusses other various possibilities that might cause this error. It also explain about the 'incorrect permissions on the endpoint'.

The article mentions the following:

"If database mirroring endpoints are configured to use Windows authentication, ensure that the SQL Server instances hosting your availability replicas run with a SQL Server startup account are domain accounts."

But in my lab environment the SQL Server startup accounts were not using domain accounts instead using the NT Service\MSSQLSERVER.

Then I found this TechNet article: http://technet.microsoft.com/en-us/library/ms178029.aspx which mentions this:

"If the instances of SQL Server run as the Network Service account, the login of the each host computer account (DomainName\ComputerName$) must be created in master on each of the remote server instances and that login must be granted CONNECT permissions on the endpoint. This is because a server instance running under the Network Service account authenticates using the domain account of the host computer"

I think this explains better and it is more closer to my environment. After reading the above I gave the CONNECT permissions to all of the SQL server computer accounts to the endpoint and resolved the issue. Here are steps to identify the endpoint and how to give CONNECT permissions to a computer account:

To identify the endpoint:

 USE master;
 SELECT name, state_desc, port from sys.tcp_endpoints where type_desc='DATABASE_MIRRORING'

To give CONNECT permissions on the endpoint for my SQL Servers. Note: In my lab I have 1 primary (SQL1) and 2 Replica Servers (SQL2, SQL3). Execute below for each server on each server. Replace the highlighted parts corresponding to your environment.

 USE master;
 GRANT CONNECT on ENDPOINT::Hadr_endpoint TO [Contoso\SQL1$];

Alternate Solution: This is provided by Lawrence Wheat in the Comments section. Note that I have not verified this fix.

If your SQL servers are on your domain, you can run the SQL services on all nodes under the same domain account.

Comments (9)
  1. CD says:

    Thanks for this article. It helped me fix the issue with AAAG where I had named instances that needed the CONNECT permission.

  2. Gareth says:

    Ugh – thank you so much! This worked great.

  3. adriano says:

    thanks, giving SQL rights between the 2 DBS it worked for me, and ‘Always on’ installed.

  4. Lance says:

    Thanks! Solved my AG issues.

  5. I am glad this post helped you all to successfully install AlwaysOn.

  6. Lawrence Wheat says:

    Thanks so much for this post. Fix #2 did the trick for me. Why in the heck the wizard doesn’t setup these permissions for you is beyond me. It almost sounds like a bug.

  7. Lawrence Wheat says:

    I will add that I found another way that you can avoid needing to apply fix #2. If your SQL servers are on your domain, you can run the SQL services on all nodes under the same domain account.

    1. Thanks a lot for sharing the fix that you found @Lawrence Wheat. I updated the article with your solution. 🙂

  8. Anders Uhl Pedersen says:

    I have experienced this issue in a situation where it turned out that the root cause was that the AD-account on the secondary had TempDB as default database instead of Master

Comments are closed.

Skip to main content