How To: Backup to SQL Server directly Azure Government Storage Account


You might run into some problems importing your Azure Government publish settings file into SQL Server. However you can still backup to Azure Government Storage Accounts using the Storage Account keys.

Step 1: Create a credential
USE master
CREATE CREDENTIAL <name of cred> WITH IDENTITY='<the storage account name>’, SECRET='<one of the storage account keys>’

To get the name and keys, navigate to your storage account in the Azure Gov Management portal and select “Manage Access Keys”. You will see them here.
blog01

blog02
Step 2: create the backup using the credential you created
BACKUP DATABASE <name of db> TO  URL = N'<backup endpoint>’
WITH  CREDENTIAL = N'<name of cred>’
, NOFORMAT, NOINIT,  NAME = N'<name of backup>’, NOSKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO

The backup endpoint should look like this
https://<storage account name>.blob.core.usgovcloudapi.net/<container name>/<file name>.bak

 

 

Comments (0)

Skip to main content