Granting One Account Log on as a Service in a GPO Strips NT SERVICE Accounts and Stops SQL Server With Error 1069
Overview
A GPO user right overwrites the local list, so SQL Server's per-service account loses Log on as a service. Add NT SERVICE\ALL SERVICES to the GPO.
At a glance
- Symptom
- SQL Server, or another service that runs under an NT SERVICE account, refuses to start after a reboot or a service restart, often days…
- Likely cause
- A user right defined in a GPO replaces the value on the computer; it is not merged with it.
- Impact
- Every service on a server in the GPO's scope whose account is not on the GPO's list stops being able to start.
- Verification signal
- The fix holds when a restart survives a policy refresh.
- Safe correction
- Add NT SERVICE\ALL SERVICES to the GPO that defines the right, because that is the list every server in scope receives.
- Rollback or recovery
- Rollback puts the GPO back to the backup taken before the edit.
Defining Log on as a service in a domain GPO to grant one new service account does not add that account to each server’s list. The GPO’s list overwrites the local one, so per-service accounts granted the right locally, such as NT SERVICE\MSSQLSERVER and NT SERVICE\MSSQL$MICROSOFT##WID, lose the right. The next time those services start they fail with error 1069 and Service Control Manager event 7041. The fix Microsoft documents is to add NT SERVICE\ALL SERVICES to the same GPO setting, next to the account you meant to grant, rather than switching the service to LocalSystem or granting the right by hand on each server.
Symptom
SQL Server, or another service that runs under an NT SERVICE account, refuses to start after a reboot or a service restart, often days after the GPO change. The Services console reports “Error 1069: The service did not start due to a logon failure”, and starting it from a command prompt reports “System error 1069 has occurred.” The System log holds event 7041 from Service Control Manager:
The MSSQLSERVER service was unable to log on as NT Service\MSSQLSERVER with the currently configured password due to the following error:
Logon failure: the user has not been granted the requested logon type at this computer.
Service: MSSQLSERVER
Domain and account: <AccountName>
This service account does not have the required user right "Log on as a service."
On a server where Windows Internal Database is being added, for example with AD FS, the WID install fails with the same message naming NT SERVICE\MSSQL$MICROSOFT##WID, or the service appears installed but never starts.
Why adding one account looks safe
The change feels additive. You open the setting in the Group Policy Management Editor, add the gMSA or domain account for the new application and link the GPO to the servers OU. Nothing breaks at once, because services that are already running are not stopped by a user rights change; Microsoft notes a rights change takes effect the next time the account logs on, and a service logs on when it starts. The local list in secpol.msc already held entries that installers put there, so it is natural to assume the GPO merges with them. It does not, and the gap between the change and the first restart hides the link between the two.
Root cause
A user right defined in a GPO replaces the value on the computer; it is not merged with it. Microsoft’s reference for the setting (constant SeServiceLogonRight, under Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment) says Group Policy settings applied from the site, domain and OU will overwrite settings on the local device at the next Group Policy update. Its effective default on member servers is Network Service only, and Network Service holds the right by definition rather than through the setting.
Everything else on that list was put there locally. SQL Server Setup grants Log on as a service to the Database Engine’s per-service SID (NT SERVICE\MSSQLSERVER for a default instance, NT Service\MSSQL$<instance_name> for a named one), and to components such as Integration Services, Full-text search and Launchpad. Windows Internal Database’s virtual account gets the right from local Group Policy. Microsoft’s WID article spells out the result: when a GPO linked to a site, domain or OU overwrites the local setting, the virtual account no longer has the right.
Impact
Every service on a server in the GPO’s scope whose account is not on the GPO’s list stops being able to start. That includes SQL Server instances, their related services, WID behind AD FS, and any service running under a domain account that someone granted the right to locally. Running services continue until their next start, so the failures arrive in waves: patch-night reboots, cluster failovers and service restarts.
Check whether the GPO took the right away
Run these on an affected server as a local administrator. The first only reads the log; the other two write a report file to a folder you choose and change no settings.
Get-WinEvent -FilterHashtable @{LogName='System'; Id=7041} -MaxEvents 20lists the logon-type failures. Each one names the service and the account in “Domain and account”, which gives you the list of identities that lost the right.secedit /export /mergedpolicy /areas user_rights /cfg C:\Temp\rights.infexports the merged domain and local user rights. Find theSeServiceLogonRightline: it holds only the accounts in the GPO, with noS-1-5-80-entries for the per-service accounts.S-1-5-80is the NT Service prefix.gpresult /scope computer /h C:\Temp\gp.htmlsaves the computer’s Resultant Set of Policy. Under User Rights Assignment, the Log on as a service row names the GPO that set it.
Following along? Tap a step’s number to tick it off.
If the 7041 account is on the exported list, the cause is something else: check for a Deny log on as a service assignment, which takes precedence, and the account and password causes in Microsoft’s error 1069 article.
The quick fixes that cost more
Granting the right again in secpol.msc starts the service, and the next Group Policy refresh removes it; Microsoft’s SQL article warns that a right that keeps disappearing is being removed by a GPO. Switching the SQL Server service to LocalSystem also gets it running, but LocalSystem has extensive privileges on the computer, its token carries BUILTIN\Administrators, and it presents the computer’s credentials to remote servers. A database engine that needed only its own per-service SID now runs as the most powerful identity on the box. Microsoft also says to change a SQL Server service account only with SQL Server tools such as SQL Server Configuration Manager. Excluding the server from the GPO is Microsoft’s other workaround, but it drops every other setting that GPO carries, along with the account you meant to grant.
Correction
Add NT SERVICE\ALL SERVICES to the GPO that defines the right, because that is the list every server in scope receives. You need edit rights on the GPO and the GroupPolicy PowerShell module.
- Back up the GPO:
Backup-GPO -Name "Servers - User Rights" -Path C:\GpoBackups -Comment "Before ALL SERVICES". Stop if the backup fails. - Save its current settings for comparison:
Get-GPOReport -Name "Servers - User Rights" -ReportType HTML -Path C:\Temp\before.html. - In the Group Policy Management Editor, open Log on as a service in that GPO and add
NT SERVICE\ALL SERVICESalongside the account you granted. Add any domain service account the 7041 events named. Services that have not restarted yet have logged nothing, so also check the export from a server of the same role outside the GPO’s scope, if you have one. Leave the new account in place. - On one affected server, run
gpupdate /target:computer /force, thenStart-Service -Name MSSQLSERVER(or the service name from the event). Stop and roll back if it still logs 7041. - Once that server is healthy, let the other servers pick up the change at their next refresh, or run the same
gpupdateon each.
NT SERVICE\ALL SERVICES (S-1-5-80-0) is a group that includes every service process configured on the system, with membership controlled by the operating system. It covers the per-service accounts of SQL Server, WID and any later install, so you do not have to list them one by one. The residual risk is small: only administrators can install and configure services, as the policy reference notes.
Verification
The fix holds when a restart survives a policy refresh. Re-run the secedit /export /mergedpolicy command and confirm SeServiceLogonRight now includes *S-1-5-80-0 or NT SERVICE\ALL SERVICES as well as the new account. Restart the SQL Server service, run gpupdate /target:computer /force, restart it again, and check that no new 7041 events appear. Confirm the new application’s service, the one the GPO was created for, also starts.
Rollback
Rollback puts the GPO back to the backup taken before the edit. Restore-GPO -Name "Servers - User Rights" -Path C:\GpoBackups restores its most recent backup. That brings back the broken list, so use it only if the edit itself caused a new problem, then refresh policy on the servers and investigate before trying again. Nothing in this fix changes service accounts or SQL Server configuration, so there is nothing to undo there.
Stop it happening with the next user right
Treat every user right as a full list, not an addition. Before defining one in a GPO, export the merged rights from a representative server of each role with secedit /export /mergedpolicy /areas user_rights and copy every entry you still need into the GPO. For Log on as a service, include NT SERVICE\ALL SERVICES from the start. Link the GPO to a test OU holding one SQL Server and one WID server, restart their services after a refresh, and only then link it to production. Earlier Config Traps cover two related surprises: a Group Policy Preferences PATH item that overwrites the whole system PATH, and removing Authenticated Users from a GPO’s security filtering.
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
NT SERVICE\MSSQLSERVERNT SERVICE\MSSQL$MICROSOFT##WIDNT SERVICE\ALL SERVICESWhen to escalate
Validation and rollback are covered in the sections above.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
