Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

SQL Agent backup job fails with error 15404: could not obtain information about Windows user

Technical article
Backup & Recovery

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When a SQL Server Agent job fails with error 15404, SQL Server could not look up the Windows account that owns the job, so the job does not run. On a backup job, nothing about the job itself has changed, which makes the failure look random. Common causes include an owner account that no longer exists, or a SQL Server Agent service account that is not allowed to look the owner up in Active Directory. The fix is a deliberate change of owner, plus a repair of the lookup if that is what broke.

What the error means

Microsoft documents event 15404 with the message text Could not obtain information about Windows NT group/user '*user*', error code *code*. SQL Server "uses event 15404 during authentication when an invalid principal is specified. Or, impersonation of a Windows account fails because there's no full trust relationship between the SQL Server service account and the domain of the Windows account" (MSSQLSERVER_15404).

On an Agent job, the full text recorded in a Microsoft Q&A thread (SQL Server 2017, August 2020) looks like this: The job failed. Unable to determine if the owner (myNetwork\myUsername) of job MaintenancePlan_FULL_Backup.Subplan has server access (reason: Could not obtain information about Windows NT group/user 'myNetwork\myUsername' error code 0x5. [SQLSTATE 42000] (Error 15404)) (Microsoft Q&A).

Why the job owner matters: "SQL Server Agent runs Transact-SQL job steps in the job owner's security context" (sp_update_job). The owner is stored as a security identifier (SID) in msdb.dbo.sysjobs.owner_sid. A job owned by a person is therefore only as reliable as that person's account.

In that Q&A thread, the error code 0x5 was explained as the Windows error "Access is denied". A volunteer moderator said the SQL Server Agent service account lacked enough Active Directory permissions to resolve the owner. A Microsoft staff member reported reproducing the problem and fixing it by changing the Agent service account to an appropriate domain account. Treat this as a community and support-engineer observation on one case rather than a vendor specification.

Example (illustrative): on SQL01, the job Nightly_Full_Backup is owned by CONTOSO\jsmith, whose account was removed in an offboarding step. The next 01:00 run fails with error 15404 and a code in the message. No change was made to the job. Microsoft's 15404 page lists an invalid principal as a cause but does not name departed staff, so a removed account is the likely explanation here, not a documented certainty.

Likely causes

Cause What you see How to confirm
Owner account no longer exists or is misspelt (an "invalid principal") 15404 on the job, started when the account was removed or renamed xp_logininfo reports an error for the account; the account is missing in Active Directory
Agent service account cannot look the owner up in Active Directory 15404 with error code 0x5 (access denied) Compare the account the Agent service runs as with its Active Directory permissions
No full trust between the service account's domain and the owner's domain 15404 where the owner is in a different domain Check the domains of the Agent service account and the owner
Service runs as a machine account (Network Service, Local System) that the owner's domain does not trust Domain-owned jobs fail with 15404 Microsoft's page names this case
Service account locked out of Active Directory Domain-owned jobs may start failing together Check the service account in Active Directory

Prove the cause before changing anything

All read-only. They have not been run or lab-tested. The two inventory queries in steps 2 and 3 are built from the documented owner_sid and sid columns; they are not Microsoft examples.

  1. Read the failure text. Note the owner name and the error code in the job history or the Windows Application log. The Q&A thread quotes this text from the Windows Application log.
  2. List every job and its owner. owner_sid is the SID of the owner; joining to sys.server_principals on sid resolves it to a name if a login exists:
SELECT j.name AS job_name, j.enabled,
       p.name AS owner_login, p.type_desc, p.is_disabled
FROM msdb.dbo.sysjobs AS j
LEFT JOIN sys.server_principals AS p
  ON p.sid = j.owner_sid
ORDER BY p.name, j.name;

A NULL in owner_login means no server principal with that SID is present. A type_desc of WINDOWS_LOGIN is a Windows user login, and is_disabled = 1 is a disabled login.

  1. List every database owner. sys.databases has an owner_sid too:
SELECT d.name AS database_name,
       p.name AS owner_login, p.type_desc, p.is_disabled
FROM sys.databases AS d
LEFT JOIN sys.server_principals AS p
  ON p.sid = d.owner_sid
ORDER BY p.name, d.name;
  1. Test that SQL Server can resolve the account. xp_logininfo returns information about Windows users and groups. It needs CONTROL SERVER or an explicit EXECUTE grant. The account must be fully qualified:
EXECUTE xp_logininfo N'DOMAIN\accountname';

Microsoft says that if the name "isn't associated with a SQL Server login", an empty result set returns, and that if it "can't be identified as a valid Windows user or group, an error message is returned". An error here is consistent with an invalid principal. A successful row suggests the lookup works and the owner is not the problem, which points to the service account or trust.

  1. Identify the Agent service account in the Services console or SQL Server Configuration Manager, and check with your directory administrator whether it is locked out, trusted by the owner's domain, and allowed to read account information.

Fix

Pick the fix that matches the finding.

Owner no longer exists, or the owner is a person. Change the owner on purpose. Microsoft says only members of sysadmin can change job ownership, and warns that the steps then "run under the new owner's permissions":

USE msdb;
EXECUTE dbo.sp_update_job
    @job_name = N'Nightly_Full_Backup',
    @owner_login_name = N'<new owner login>';

Which principal to use is a security decision. In the Q&A thread, the asker found the job ran after the owner was changed to sa. That is a sysadmin login, so the steps then run with full permission. Microsoft's 15404 page lists "Use a SQL Server account" among its options. A practical rule: own jobs with a dedicated, non-personal login given only the permissions the job steps need. Check what each step does before you decide. Changing the owner changes who the steps run as, so do not do it blindly for jobs whose steps use linked servers, proxies or cross-database permissions.

Database owned by the missing account. ALTER AUTHORIZATION ON DATABASE::<name> TO <login>; changes a database owner. The new owner for SQL Server must be a SQL Server login, a Windows login representing a Windows user (not a group), or a Windows user who authenticates through a login representing a group. You need sysadmin, or TAKE OWNERSHIP on the database plus IMPERSONATE on the new owner login. Decide first whether anything depends on the existing owner.

Service account cannot look up the owner. Run SQL Server Agent under an account that has the required rights in the owner's domain. The Microsoft engineer's fix in the thread was to change the Agent service account to an appropriate domain account. Microsoft says the supported way to change a SQL Server service account is SQL Server Configuration Manager (MSSQLSERVER_5120; that page is about SQL Server itself, so check the equivalent guidance for the Agent service). This is a change to a service identity, so plan it, and test jobs afterwards.

Trust or machine account. Microsoft's 15404 page lists: use an account from the same domain as the Windows user for the SQL Server service; if a machine account (Network Service or Local System) is used, the machine must be trusted by the domain of the user; use a SQL Server account; and ensure the domain service account is not locked out.

Confirm the fix

  • Run the job once and read its history. It should complete without 15404.
  • A new row appears in the msdb backup history for the backup the job takes. A job that reports success is not proof that a backup is restorable, so restore the new backup to another server. See the article on proving a backup will restore.
  • Re-run the owner inventory. No job or database should have a NULL owner or a disabled one.
  • Leave the job on its normal schedule and check the next scheduled run, as well as the manual one.

What to watch afterwards

  • Make job and database ownership part of the offboarding checklist for departing administrators. The article on revoking a departed administrator's access covers the access side.
  • Re-run the two inventory queries on a schedule and alert on NULL or disabled owners.
  • Configure job failure notification. sp_update_job has @notify_level_email and @notify_email_operator_name to email an operator when a job completes in a set way (2 is "on failure").
  • Recheck job ownership after any move of the SQL Server to a new domain, or any change to the service account. The article on Kerberos after a server move covers related identity problems.

Risks and limits

  • These queries and commands have not been run or lab-tested.
  • Microsoft's 15404 page does not mention SQL Agent job owners, departed staff or disabled accounts. Its stated causes are an invalid principal, no full trust, an untrusted machine account and a locked-out service account. Microsoft does not document the departed-account link; treat it as a likely cause, not a certainty.
  • The meaning of 0x5 as "access denied" and the cause in the Agent case come from one Microsoft Q&A thread from 2020 on SQL Server 2017. Microsoft does not tabulate other error codes on these pages, so look up the code in your own log.
  • The pages do not say whether a disabled (as opposed to deleted) Active Directory account produces this error.
  • Changing an owner changes the security context of every step. Changing a database owner can change what an application can do.
  • Microsoft does not say what happens to a SQL Server login that maps to a removed Windows account, or how to clean it up.

Sources