Sql-server – How to Backup to Azure Storage

azureazure-blob-storagesql serversql-server-2017

A day before I tried to back up our ddbb log file to azure storage. So, the transact is simple

backup [log|database] <name>
To URL = <Azure_Storage_url>

Credentials are defined apart,

CREATE MASTER KEY ENCRYPTION BY PASSWORD = <Key>

CREATE CREDENTIAL <name_credentials>
WITH IDENTITY = 'SHARED ACCESS SIGNATURE'
    ,SECRET   = <SAS_Token>
go  

I got the error below:

Msg 3201, Level 16, State 1, Line 34
Cannot open backup device <Azure_Storage_url>. Operating system error 50(The request is not supported.).

I tested that credentials with a bulk insert on the same container I was pointing with it works fine.

The SAS token was generated with full permissions

enter image description here

No policy were made on the container since I understood (Is my fault here?) that SAS token already had full access.

How can I do a successful backup from scratch?

Thanks!

Best Answer

No policy were made on the container since I understood (Is my fault here?) that SAS token already had full access.

Backup to URL requires a SAS Token generated from a Container Access Policy with fixed start and Expiration Dates. An Storage Account-scoped SAS token will not work.