Skip to main content

System.Data.SqlClient.SqlError: Cannot open backup device ''. Operating system error 5(Access is denied.)

To prepare a Team Foundation Server upgrade, I was creating backups of some databases. But I didn’t got far, because following error was shown in the SQL Server Management studio each time I tried to create a backup:

System.Data.SqlClient.SqlError: Cannot open backup device 'd:\backups'. Operating system error 5(Access is denied.). (Microsoft.SqlServer.Smo)

Even after logging in as Administrator , I got the same error. 

After some investigation I found out that it doesn't matter who *you* are logged in as, it is the service account for SQL Server service that matters. So after changing the security permissions on the ‘d:\backups’ folder to give the service account (Network Service) write permissions, everything worked.