info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



Microsoft Azure Blob Storage Service as a backup destination
by BF (Principal Consultant; Architecture; Engineering)
2015-11-07







Backing up to or restoring from the Microsoft Azure Blob storage service.


MSDN:

Microsoft Azure Blob storage service:

Storage Account: The storage account is the starting point for all storage services. To access the Microsoft Azure Blob storage service, first create a Windows Azure storage account. For more information, see Create a Storage Account

Container: A container provides a grouping of a set of blobs, and can store an unlimited number of blobs. To write a SQL Server backup to the Microsoft Azure Blob storage service, you must have at least the root container created. You can generate a Shared Access Signature token on a container and grant access to objects on a specific container only.

Blob: A file of any type and size. There are two types of blobs that can be stored in the Microsoft Azure Blob storage service: block and page blobs. SQL Server backup can use either blob type depending upon the Transact-SQL syntax used. Blobs are addressable using the following URL format: https://<storage account>.blob.core.windows.net/<container>/<blob>.


Solution:


T-SQL:

Execute w/ On-Prem SQL Server:

CREATE CREDENTIAL CredentialOPS01 WITH IDENTITY = 'stgacc01'
,SECRET = 'xxxxxxxxxxxxInsertKeyHerexxxxxxxxxxxx';

BACKUP DATABASE OPS
TO URL = 'https://stgacc01.blob.core.windows.net/mssqlbackups/ops.bak'
WITH CREDENTIAL = 'CredentialOPS01'
,STATS = 5;
GO

Execute w/ Azure VM running SQL Server:

USE [master]
RESTORE DATABASE [OPS] FROM URL = N'https://stgacc01.blob.core.windows.net/mssqlbackups/ops.bak'
WITH CREDENTIAL = N'CredentialOPS01' ,
FILE = 1,
MOVE N'OPS' TO N'F:\DB\OPS.mdf',
MOVE N'OPS_Log' TO N'F:\DB\OPS.ldf',
STATS = 5
GO



Image #1: Azure Portal






Resources:

SQL Server Backup to URL

CREATE CREDENTIAL (Transact-SQL)

Backup to URL fails...