Project Description
It's a simple Azure Worker that will backup any of your SQL Azure Database tables to selected Azure Blob Storage using BCP utility.
Why BCP?
Because it is possible to backup Azure SQL Federations. You can specify every federation as a separate database (same server, different database name) and it will backup all tables of that federation.
Most of code is based on project http://azureautobackup.codeplex.com i have mostly simplified the code to support onlu Azure Blob Storage destination, added 7zip compression.
How to start?
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXX;AccountKey=XXX" /> <Setting name="DataConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXX;AccountKey=XXX" /> <Setting name="LogError" value="True" /> <Setting name="LogAction" value="True" /> <Setting name="InputXMLBlobConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXX;AccountKey=XXX" /> <Setting name="InputXMLBlobContainerName" value="config" /> <Setting name="BcpLocation" value="D:\Program Files\Microsoft SQL Server\100\Tools\Binn" />
How it works?
After deployment package will automatically install BCP as a Startup Task.
Then it will download config file from Azure Blob (defined in point 5) and read backup details.
It will execute BCP for each table in each database that should be backed up (hasn't been backed up for BackupScheduledPeriod hours). It will connect to server ServerName using LoginId and Password and create .dat files. File name template is defined in config as BackupFileName
After BCP finish, it will execute 7za to compress backup file to ZIP and then upload it to Azure Blob defined by parameters StorageAccountName, StorageAccessKey, BlobContainerName.
IMPORTANT:
BCP doesn't store database definitions (tables, views, procedures). It stores only raw table data. You MUST backup you table definition some other way, like using Visual Studio Source Control or any other way. You MUST have database definitions to recover data stored by BCP.
Read more about BCP here: http://msdn.microsoft.com/en-us/library/ms162802(v=sql.105).aspx