Azurewebsites backup with webjobs

We have some low traffic websites hosted in azure. Backups are important to us, but only available on the Standard web hosting plan. So we created a webjob to do it.

azurewebsite backup only available in Standard web hosting plan

Following Eduardo Laureano‘s post the plumbing was soon done. We modified the code to upload a zipfile and we’re done. Some of the changes in code block below.

// format filename as AzureBackup would
string backupName = string.Format("{0}_{1}.zip", 
string zipFile = Path.Combine(Path.GetTempPath(), backupName);
// ZipFile is in System.IO.Compression.FileSystem
ZipFile.CreateFromDirectory(DIRECTORY_TO_BACKUP, zipFile);
// Create block blob for zipfile upload
CloudBlockBlob blockBlob = 
using (var fileStream = File.OpenRead(zipFile)) {
// Clean up temporary local file

The webjobs is scheduled to run every week. Now we get weekly backups of our files. Not as nice as Microsoft does it with fancy restore, database include and xml listing of files, but it suits our needs.


About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.