Sometimes there are errors which give us the solution to the problem and I love to discover other ways to fix it. In this blog, we would learn how to fix Failed to create the Windows Server Failover Clustering (WSFC) resource with name and type ‘SQL Server Availability Group’
Here is the exact error which I received while creating an availability group:
Msg 41105, Level 16, State 0, Line 3
Failed to create the Windows Server Failover Clustering (WSFC) resource with name ‘SQLAUTHORITY_AG’ and type ‘SQL Server Availability Group’. The resource type is not registered in the WSFC cluster. The WSFC cluster many have been destroyed and created again. To register the resource type in the WSFC cluster, disable and then enable Always On in the SQL Server Configuration Manager.
Msg 41152, Level 16, State 2, Line 3
Failed to create availability group ‘SQLAUTHORITY_AG’. The operation encountered SQL Server error 41105 and has been rolled back. Check the SQL Server error log for more details. When the cause of the error has been resolved, retry CREATE AVAILABILITY GROUP command.
The T-SQL which I used was as follows.
USE [master] GO CREATE AVAILABILITY GROUP [SQLAUTHORITY_AG] WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY, DB_FAILOVER = OFF, DTC_SUPPORT = NONE, REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT = 0) FOR DATABASE [SQLAUTHORITY_DB] REPLICA ON N'NODE1' WITH (ENDPOINT_URL = N'TCP://NODE1.SQLAUTHORITY.COM:5022', FAILOVER_MODE = AUTOMATIC, AVAILABILITY_MODE = SYNCHRONOUS_COMMIT, SESSION_TIMEOUT = 10, BACKUP_PRIORITY = 50, SEEDING_MODE = MANUAL, PRIMARY_ROLE(ALLOW_CONNECTIONS = ALL), SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)); GO
Here is the screenshot of the error message.
I checked ERRORLOG and there were no messages. As the error message says, “The resource type is not registered in the WSFC cluster” so I checked the PowerShell to get resource type and found below.
Get-ClusterResourceType | where name -like "SQL Server Availability Group"
The output showed no result which means the error message is correct.

As we can see there is no result and that’s what is being told by an error message.
WORKAROUND/SOLUTION
I was able to find two ways to fix the issue:
- Register the resource type manually using below PowerShell.
Add-ClusterResourceType -Name "SQL Server Availability Group" -DisplayName "SQL Server Availability Group" -Dll "C:\Windows\System32\hadrres.dll"

- The better way is: Disable and Enable the feature using SQL Server Configuration Manager. That is what has been told in error message as well.
Now, if we run the same command as earlier, we should see the output

Have you encountered the same error? What was the cause of it?
Reference: Pinal Dave (https://blog.sqlauthority.com)







2 Comments. Leave new
Hello,
I find the simple solution. open the SQL Server Configuration Manager, Right Click on the SQL Instance, , Click on Always on Availability Group Tab and Uncheck Enable Always On Availability Groups. check the box again and than Restart the SQL service, than you dont need to do the powershell hard coding into the DLL as you described.
Thank you
In some cases, the issue has been resolved by disabling the AlwaysOn Availability Groups feature in SQL Server Configuration Manager, restarting the service, re-enabling it, and then restarting the service.
SQL Server instances cache AlwaysOn-related settings in the registry and WSFC metadata.
A mismatch between these values can result in errors that appear to be “permission issues” when creating resources.
Restarting the service clears the cache and resynchronizes metadata between WSFC and SQL Server.
This issue did not occur when installing SQL products first and then the WSFC service. However, it did occur when installing WSFC services first and then the SQL products. This issue likely occurred due to a difference in order, which prevented metadata synchronization.