Sql-server – Sql Server Backup to URL (Azure) ERROR

backupsql server

I'm trying to take advantage of the new backup to url function in SQL Server. I have created a valid cert and tried a simple backup, but I get the same error every time no matter what I try.
I have also tried creating a new managed backup. With the managed backup I see a new storage container but get no new blobs. When I look through the logs it is getting the same error.

example:

BACKUP DATABASE [mydb] 
TO  URL = 'https://mybackups.blob.core.windows.net/sqltest-mssqlserver/backup_2014_08_08.bak' 
WITH  
CREDENTIAL = N'AzureCreds' , 
STATS = 1
GO

Message:

Msg 3293, Level 16, State 1, Line 1
An error occurred while Backup/Restore to URL was initializing. Error message: Internal engine error, invalid parameters caused fatal error.

Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.

Best Answer

You might have an issue with your credentials. I recently used the following command successfully to back up to SQL Azure:

BACKUP DATABASE [MyDatabaseName] TO URL = N'https://mystorageaccount.blob.core.windows.net/mycontainer/MyDatabaseName_backup_2014_12_19_124300_8473463.bak' 
WITH CREDENTIAL = N'MyCredentialName', 
    NOFORMAT, NOINIT, 
    NAME = N'MyDatabaseName_backup_2014_12_19_124300_8473463',
    SKIP, REWIND, NOUNLOAD, 
    COMPRESSION, STATS = 10;

The credential was set up with MyCredentialName as the 'Name', the storage account name as the 'Identity', and primary or secondary access key as the 'Password'.

I ran into problems with the credential originally because I was trying to use the credential format supported for using Azure storage as the file location for the database (i.e. url prefix for 'Name', "SHARED ACCESS SIGNATURE" for Identity, and everything after the "?" from shared access signature url for the password), and that apparently does not work with the BACKUP command.