How to take SQL SERVER backup to Azure Blob Storage

This guide will walk you through creating a backup file of your SQL Server database directly into the Azure Blob Storage using BACKUP DATABASE <DBName> to URL.

We are going to take SQL Server backup to Azure Blob Storage. The SQL Server Complete Backup to Azure Blob Storage is ideal for scenarios that require integration with other Azure technologies.


Note: For this article, you require the following prerequisites


  • Azure Storage account and blob container

  • SQL Server Management Studio

  • SQL Server instance

The steps to take SQL Server database backup directly to Azure Blob Storage are below.

Access keys for the storage account

Go to your Azure Storage account and note down the access key in the Azure portal.


Access keys for the storage account
Create credentials for on-premise SQL Server

CREATE CREDENTIAL mysqlcredential
WITH IDENTITY= 'dataexportsql' --Specify the Azure storage account name
, SECRET = 'iS+laBj0CwcD3u+ ==' -- Specify the access key noted for the storage account

Create credentials for on-premise SQL Server
Backup Database to Azure blob storage

Go to Azure blob container properties and note its URL as highlighted below.


Backup Database to Azure blob storage

The backup Database script uses the URL and credential to take backup directly to Azure blob storage.


BACKUP DATABASE DBBlogger
TO URL = 'https://dataexportsql.blob.core.windows.net/sqlbackups/DBBlogger.bak'
WITH CREDENTIAL = 'mysqlcredential';
GO
backup Database script

Once the backup finishes, you can view the backup file in the blob container, as shown below.

Verify SQL Database backup


87 views0 comments