Users: 15,000+ | Page Views: 50,000+ | PPS: 2.5
TechDevOps.com
Explore Tools
{Experts in Microsoft SQL Server Operations, Performance, HA/DR, Data Migrations & Cloud Computing}



Microsoft Azure Blob Storage Service as a backup destination
by BF (Senior MSSQL Operations - Enterprise, Cloud, Strategy)
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...