SQL Server automatic startup failure using gMSA

Oopps! Upgrade your browser pretty please. Oopps! Upgrade your browser pretty please.

Have you ever done the proper thing and configured your SQL instance or SQL AOAG cluster instances using Group Managed Service Accounts (gMSA) and found yourself seeing the following errors (7000 and 7034) in the Windows Eventlog stating that the SQL Server Service could not start due to a logon failure and that the service terminated unexpectedly?

These error messages is also accompanied by the following error message 7038 that might confuse the situation even more, insinuating that the error might be network related, which it to a certain degree is, but boils down more to how Windows behaves at startup and what your newly configured gMSA accounts requires to start.

This behavior seems to be related to certain systems where the SQL server service startup comes faster than the OS starting up its network connectivity, that is the OS tries to start SQL server before the network service is up and running. Why this happens is hard to tell, it comes in both hardware and virtual setups, but not on all setups.

The fix for this at this point is to make sure that the proper network services is started in the OS BEFORE the SQL server services is trying to be started and this is handled by adding dependencies on the SQL Server service and the services that needs to be started in windows before the SQL Server service can be started is the W32Time and NetLogon Services and is added by using the registry editor and adding the value data as seen in the picture below to the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\%MSSQLSERVERINSTANCE%.

In the below case where multiple SQL Server Named Instances is installed using gMSA, DependOnService needs to be edited on all SQL Instance registry keys.

When this is added you will on the SQL Server service under Services see the following system components dependencies added on the service and you are good to go.

Now the SQL server service will start automatically the next time you reboot your server.

Need help with all things related SQL Server, don’t hesitate to contact us at SQL Service for a chat.