Good morning all ,

I must configure an automated backup to an azure blob storage

in the backup script I have correctly configured the credential

now what right is needed for the sql server agent startup account to access the storage azure blob

thank you for your help


1 Answer 1


You can do this by simply using storage account and storage key ( its preferable to use SAS token but I will give a code for using storage key as I have been using one for my personal use)

I am using Azure Fileshare instead of Blob storage so you will need to make a few minor changes. I use powershell and Az module. then I call that using powershell.exe using SQL Server agent at cmd mode.

##assuming you are using on-premise or Azure VM SQL Server

##set location to backup file location

cd W:\backups\bakfiles

$storageaccount = 'mystorageaccount'
$storagekey = 'my//storagekey==' (you will find this option in storage account in Azure portal)
$stcon = New-AZStorageContext - StorageAccountName $storageaccount -StorgeAccountKey $storagekey
$Container = Get-AzStorageshare -Name "MyStorageshare" -Context $stcon
$currentfolder = (get-item .).Fullname
Get-Childitem -Recurse |where-object {$_.GetType().Name -eq "FileInfo"} |Foreach-Object {
Set-AzStorageFileContent -Share $Container.CloudFileshare -Path $path -Source $_.Fullname -Force}

Not the answer you're looking for? Browse other questions tagged or ask your own question.