It’s always a good idea to be up-to-the-speed with the current market trend. As a part of my consulting I have been getting calls from clients having issues with Azure. So, I started learning Azure as well. Let us learn about how to fix the URL error.
Recently, I was trying to take backup of the database to Azure and was stuck with an error message.
Msg 3201, Level 16, State 1, Line 4
Cannot open backup device ‘https://sqlauthsqlbackups.blob.core.windows.net/backups/master.bak’. Operating system error 50(The request is not supported.).
Msg 3013, Level 16, State 1, Line 4
BACKUP DATABASE is terminating abnormally.
Before I move ahead, I should share that there are two kinds of backup methods available. In both methods we need to create credentials. The credential can be created using either access keys or SAS token. The method which I was using was with SAS token.
My steps were very simple.
- Create a storage account.
- Generated the Shared Access Signature (SAS) from the Portal.
- Created Credential using SAS Token.
- Perform backup of the database using “Backup to URL” command.
I searched on the internet and realized that I missed one step, which is not very explicitly called out in Microsoft documentation.
You need to create a Shared Access Policy and a Shared Access Signature for the new container. There are multiple ways to do it.
- Using PowerShell.
- Using Storage Explorer.
- Using Microsoft Azure Portal.
PowerShell method is explained in this article https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url You can refer code section.
The script which is created does create SAS token, access policy and provides you ready-made T-SQL which you can directly run to create credential.
I have used portal to define the access policy. Here is the screenshot for your quick reference to understand where to click and reach there.
Home > Storage accounts > Account Name > Browse blobs > Blob Name > Access Policy
Once we click on access policy, we need to add a new policy and set all permissions along with dates. After doing that I could take backups successfully.
Reference: Pinal Dave (https://blog.sqlauthority.com)