Sql-server – unable to create this Availability Group? (error 35220)

availability-groupsclusteringsql serversql-server-2017

I was attempting to create an Availability Group on a SQL Server 2017 instance and was running into error 35220:

Could not process the operation. Always On Availability Groups replica
manager is waiting for the host computer to start a Windows Server
Failover Clustering (WSFC) cluster and join it. Either the local
computer is not a cluster node, or the local cluster node is not
online. If the computer is a cluster node, wait for it to join the
cluster. If the computer is not a cluster node, add the computer to a
WSFC cluster. Then, retry the operation.

I was stumped, because the host was most definitely part of a WSFC, and the node was online. I eventually found the answer in a blog that was focused on Multi-Subnet Availability Groups, which I hadn't looked at earlier because mine was not Multi-Subnet.

Thus, I'm posting this here to give better visibility to the solution in case some other poor DBA gets stumped the same way I did. I will post the solution below.

Best Answer

Here's the blog where I found the answer: https://bahtisametcoban.home.blog/2019/01/04/always-on-availability-groups-with-multi-subnet-failover-cluster/.

In case you don't feel like reading through it, the answer is

If you enable [Availability Groups] before cluster is fully operational and ready you will get an error when you try to create AG

When I installed and configured SQL Server on the machines in question, I jumped the gun on enabling the Availability Groups feature (SQL Server Configuration Manager->Services->SQL Server->Properties->AlwaysOn High Availability tab) and checked the box (and restarted the service) before the WSFC was created. This is what caused the error when I tried to actually create an AG.

The fix is easy: just disable Availability Groups, restart the service, then re-enable them and restart it again.

Hope this has been helpful!