SQL Azure provides a scriptable, easy way to create a backup of a database from within SQL Management Studio. This is very useful if you need to create a backup before making a large production change, or if you just need an archive/snapshot of your current data.
Additionally, SQL Azure gives you the ability to check on the status of the backup via a SQL query. Using that, we can create a small script to monitor the status of the backup and let us know when it has finished:
CREATE DATABASE TheNameOfYourDatabaseBackup AS COPY OF TheNameOfYourDatabaseToBeBackedUp
GO
PRINT 'Backup started at ' + CAST(DATEADD(hh, -5, GETDATE()) AS VARCHAR(100))
WHILE (SELECT state\_desc FROM sys.databases WHERE Name = 'TheNameOfYourDatabaseBackup') = 'COPYING' BEGIN -- Check every minute to see if the backup has completed WAITFOR DELAY '00:01' END
PRINT 'Backup completed at ' + CAST(DATEADD(hh, -5, GETDATE()) AS VARCHAR(100))
GO
A few notes: