This post is a follow-on from my previous post where we set up a SQL Server Availability Group on a Windows domain. In this post, we’ll run through the process again but this time, our instances will be running under local service accounts and so the process is slightly different. As in the previous post, both instances I will work on are SQL Server 2022 Developer Edition and so benefit from Enterprise Edition features.
This post will be less thorough on screenshots and detail in those areas that were covered in the last post, though new information will be covered in the usual level of detail.
We will once again be using the OLTP and OLAP WideWorldImporters databases in this demo.
Configuration Manager Settings
As before, we’ll enable Always On Availability Groups for our instance:

In this case, we’ll be running our instances (SQL01 and SQL02) as local service accounts:

Within Management Studio, connected to the primary replica, SQL01, let’s now create the Availability Group:

This time, my databases already meet the prerequisites as they are in full recovery model from the last post and have been backed up, so we can select them straight away:

I’ll add the two replicas and set them to synchronous commit and allow them to be read-only secondaries:

I’ll leave all the other tabs as default; this will set up a new endpoint but I won’t bother with a listener for the sake of this demonstration. The default settings mean using automatic seeding.
We get the following warning due to our replicas running under a local service account:

We pass all of the prerequisites barring the expected warning about the listener:

We then get the summary screen:

After clicking Finish, we see success:

At this point, we can see that despite choosing automatic seeding, the WideWorldImporters databases haven’t been created on SQL02:

The Availability Group Dashboard can be opened to further investigate the issue. To open the dashboard, we right-click the Availability Group in the Object Explorer:

The dashboard confirms there is indeed an issue:

Clicking the Warnings hyperlink isn’t overly helpful – it just tells us the databases are not synchronised:

If we check the SQL Server error log on each node, we get a fairly good explanation of what the issue is:
SQL01 (primary):

SQL02 (secondary):

As SQL Server is running as a local account, it presents itself on the network as the AD computer account, which we don’t have a login for in SQL Server, and so it cannot use the endpoint. We need to create a login for the opposite replica’s AD computer account on both SQL01 and SQL02 and grant it permissions on the endpoint:
/* run on SQL01 */
CREATE LOGIN [DUALCORE\SQL02$] FROM WINDOWS;
GRANT CONNECT ON ENDPOINT::Hadr_endpoint TO [DUALCORE\SQL02$];
ALTER ENDPOINT Hadr_endpoint STATE = STOPPED;
ALTER ENDPOINT Hadr_endpoint STATE = STARTED;
/* run on SQL02 */
CREATE LOGIN [DUALCORE\SQL01$] FROM WINDOWS;
GRANT CONNECT ON ENDPOINT::Hadr_endpoint TO [DUALCORE\SQL01$];
ALTER ENDPOINT Hadr_endpoint STATE = STOPPED;
ALTER ENDPOINT Hadr_endpoint STATE = STARTED;
With that, the databases in the Availability Group start restoring on SQL02:

The databases eventually become synchronised:

With that, we are now set up.
What’s Different?
All in all, there isn’t a lot of difference here between setting up the Availability Group with a local account or a domain account. The distinction was that we had to manually create a SQL Server login for the AD computer account of the opposite replica on each SQL Server replica when using the local account.
If we look closely at the summary screen taken from the last post where a single AD account was used as the SQL Server service account, we can see that the setup process creates the logins for the AD service account for us:

Contrasting this to when we are running SQL Server as the local service account, we can see no login is created and as such, we need to create one manually:

Conclusion
In this post, we’ve set up an Availability Group with both replicas running under a local service account. We contrasted some of the differences between this approach and the approach in the previous blog post, where the two replicas were running under an AD account.
