I am using Ola Hallengrens DB backup and am trying to get it working with the URL parameter.
I first set up a Shared Access Credential in SQL with the following sql
USE MASTER
CREATE CREDENTIAL [https://exampleblob.blob.core.windows.net/backups]
WITH IDENTITY='SHARED ACCESS SIGNATURE'
,SECRET = 'sv=2015-04-05&ss=bf&srt=sco&sp=rwd&se=2030-11-14T20:07:06Z&st=2016-11-13T12:07:06Z&spr=https&sig=KEY'
GO
Next I tried using the following in my log backup maintenance plan:
sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d DBATools -Q \
"EXECUTE [dbo].[DatabaseBackup] \
@Databases = 'USER_DATABASES', \
@BackupType = 'LOG', \
@Verify = 'Y', \
@Compress = 'Y', \
@CheckSum = 'Y', \
@LogToTable = 'Y', \
@ChangeBackupType='Y', \
@url='https://exampleblob.blob.core.windows.net/backups', \
@Credential='https://exampleblob.blob.core.windows.net/backups'" -b
However when I run the job I get the following error
Use of WITH CREDENTIAL syntax is not valid for credentials containing
a Shared Access Signature
Best Answer
I just ran into this issue as well creating a Maintenance Plan in SQL Server. The default backup maintenance plan creates a script that includes
WITH CREDENTIAL
, but I was able to get it working when I removed that default Task. So I ended up with this code in an Execute T-SQL Statement Task: