TFS 2013 Scheduled Backups Failure (TF401009 and TF400997)


When you try one of these scenarios:

  1. Create Scheduled Backups (TF401009 and TF400997).
  2. Reconfigure Scheduled Backups (TF401009 and TF400997).
  3. Restore Databases (TF400997).
TF401009: The TFS service account NT AUTHORITY\LOCAL SERVICE cannot access network shares.  Change to an account that can access the backup path.
TF400997: SQL Server service is running as NT AUTHORITY\NETWORKSERVICE. Please change this account to an account that can be granted permission on the backup path.

Scheduled Backups end up with failure, even if you've granted permissions to the NT AUTHORITY\LOCAL SERVICE and the NT AUTHORITY\NETWORKSERVICE accounts on the backup path.

There are two methods responsible for verifying account permissions to access the backup path:

Microsoft.TeamFoundation.Admin.VerifyJobAgentCanAccessBackupPath.Run
Microsoft.TeamFoundation.Admin.VerifySqlCanAccessBackupPath.Run

which use the account types defined like this

LocalSystem	0x01
LocalService	0x02
NetworkService	0x04
User		0x08
Computer	0x10

Instead of verifying account permissions they check account type, and return an error if the JobAgent service log on as:

LocalService
NetworkService
Computer

and the Sql Server service log on as:

LocalSystem
LocalService
NetworkService
Computer

So, to run Scheduled Backups without errors you have to change the JobAgent and the Sql Server service accounts to User account. After you create scheduled backup or restore the databases, you can go back to the default accounts.