Cannot open backup device operating system error 50 azure

In this blog, I will explain how I managed to resolve the error “Cannot open backup device. Operating system error 50”.

  • Cannot open backup device operating system error 50 azure
  • Reason: Cannot open backup device. Operating system error 50
  • Solution: Cannot open backup device. Operating system error 50
  • Conclusion

Cannot open backup device operating system error 50 azure

Recently, when I was trying to create a backup of my local SQL Server database on an Azure blob container, I faced the error “Cannot open backup device ‘https://groupazurestorage.blob.core.windows.net/sqlserverbackup/backupdatabase_backup_2021_09_09_094741.bak’. Operating system error 50(The request is not supported.). (Microsoft.SqlServer.Smo)“. You can see the error in the below image:

cannot open backup device operating system error 50 azure
Cannot open backup device

I was using SQL Server Management Studio to perform this backup task. I properly followed the backup process, but still faced this error.

Read How to create table in azure sql database

Reason: Cannot open backup device. Operating system error 50

When I searched it on the web, I found many posts and blogs on this error. Most of the blogs stated that this error was triggered because there was something wrong with the Shared Access Signature token that is used to authenticate the requests made to the Azure blob container.

Some said that the credential was expired. I tried to create the credential again but still got this error.

Solution: Cannot open backup device. Operating system error 50

When I was trying to troubleshoot this error, I found a solution. The solution stated that I had to drop the existing credential because it might be expired. So I did the same. I executed the below query to see the list of credentials in the database.

SELECT * FROM sys.CREDENTIALS
Cannot open backup device. Operating system error 50
Operating system error 50

The name of the credential that I was using was “https://groupazurestorage.blob.core.windows.net/sqlserverbackup“.

I copied the credential name and used the DROP CREDENTIAL statement to drop the credential. I executed the DROP CREDENTIAL statement as:

DROP CREDENTIAL "https://groupazurestorage.blob.core.windows.net/sqlserverbackup"

After deleting the existing credential, I started the backup process again. I also generated a new Shared Access Signature and created the credential again. This time I didn’t face this error and successfully created a backup of my SQL Server database to the Azure blob container.

Read How to rename a database in Azure SQL

Conclusion

I resolved the error but I wanted to know why I faced this error. I recalled that I had created the same storage account and the blob container inside the storage account with the same name earlier.

Also, I had tried to perform the backup process. I deleted that and created the storage account and the blob container again using the same names that I used earlier.

Therefore, when I tried to perform the backup using the new storage account and the blob container and created the credential, the Backup Database Wizard was not creating a new credential.

Instead, it was using the old credential because of the same naming convention. Hence, I had to drop the old credential and create a new credential again in order to back up the database.

Thus, you might have learned the cause and the solution of the error “Cannot open backup device. Operating system error 50”.

  • cannot open backup device operating system error 50 azure

Related Posts: