Click here to Skip to main content
Click here to Skip to main content

Windows Azure File Backup Service

, 15 Mar 2013 GPL3
Rate this:
Please Sign up or sign in to vote.
Defining a Windows Service to incrementally backup an assigned directory to Windows Azure Blob Storage using Blob REST based upon root directory change notifications to FileSystemWatcher.

Introduction

There have been articles about using Windows Azure Blob Service to backup files; notably Windows Azure's sample "Synchronizing Files to Windows Azure Storage".

However, this "no rocket science" article takes it a step further by defining a complete solution:

  1. C# Libraries for syncing the file contents and their metadata of an assigned root directory to a defined Blob container within a Windows Azure Storage account using Blob Service REST API and System.IO.FileSystemWatcher class.
  2. Windows Form application for backup configuration.
  3. Windows Service to automatically perform the file backup operation based upon provided backup configuration.
  4. Windows Service Installer

Background

I am doing this article as a personal interest to review Blob Service REST API and to see it using Windows Azure Storage as resources for file backup as viable choice.

Code Plex

The solution sources are also available within CodePlex: Windows Azure File Backup Service

Solution Components

  • WindowsAzure_REST -- C# Library
    • Using Blob Service REST API:
      • Create Blob Container as a repository for holding file backup
      • CRUD service of directories and files persisted as blobs
      • Maintain directory and file metadata within each persisted blob
  • WindowsAzure_FileBackup_Common -- C# Library
    • Registering and Maintaining Windows Azure Storage access information
      • Connection Mode
        • Cloud
        • Local
      • Endpoint URL
      • Account Name
      • Account Key
      • Blob Container Name
    • Registering and Maintaining File Backup and Recovery information
    • Defines File Monitor handlers for System.IO.FileSystemWatcher
    • Support Functionality
      • Wrapper functions around aforementioned C# Library WindowsAzure_REST methods.
        • Save File to Blob Service
        • Retrieve File from Blob Service
      • File and Directory methods
        • Gather information to be used by Blob Metadata
          • FileName
          • Attributes
          • CreationTimeUtc
          • LastAccessTimeUtc
          • LastWriteTimeUtc
          • RelativePath
          • PathWithName
          • Size
          • IsDirectory
        • Determine Relative Path
  • WindowsAzure_FileBackup_Console -- Windows Form application
    • Configuration
      • Windows Azure Account Info
      • Backup and Recovery Info
    • Backup Info
      • Number of Files in Backup Directory
      • Number of Blobs in Backup Blob Container
      • Number of Files in Recovery Directory
    • Force Action
      • Complete backup of all files within Backup Directory to Backup Blob Container
      • Complete restore of all files from Backup Blob Container to Restore Directory
  • WindowsAzure_FileBackup_Service -- Windows Service
    • When started, it keeps System.IO.FileSystemWatcher monitoring changes to Backup Directory, and matches those changes within Backup Blob Container.
  • WindowsAzure_FileBackup_Service_Setup -- Installer of Windows Service
    • Service Name: "Windows Azure File Backup"

Using the Code

  1. Install, but do not Start, WindowsAzure_FileBackup_Service using Setup. It should appear within Services named "Windows Azure File Backup".
  2. Create two directories:
    • Backup Directory: e.g., F:\WindowsAzureBackupFolder
    • Recovery Directory: e.g., F:\WindowsAzureRecoveryFolder
  3. Start WindowsAzure_FileBackup_Console
    • Configure
      • Storage Account Name
      • Storage Account Key
      • Backup Blob Container
        • Default "cloudfilebackup"
      • Backup Local Path
      • Recovery Local Path
      • Connection Mode
        • Default "Cloud"
        • "Local" is only available for:
          • Windows 7
          • Windows Vista
          • Windows 2008
    • Select Button "Prepare Backup" to register configuration settings.
  4. Start Service now because configuration settings are available.

336418/WindowsAzure_FileBackup_Console.PNG

Note

  1. You need to provide a valid Storage Account Name and Key, or the Windows Service will fail.
  2. Events are logged within:
    • LogName: WindowsAzureFileBackup
    • LogSource: Service or Console
  3. All configuration setting are registered within: HKEY_LOCAL_MACHINE\SOFTWARE\jeff00seattle\WindowsAzureFileBackup

Helpful Tools

While developing the Windows Service, there were times where reinstalling was required; however, uninstalling would fail. There were two freeware tools that helped out tremendiously:

  1. Microsoft Fix-It -- Fix problems with programs that can't be installed or uninstalled.
  2. Uninstall Tool -- Ultra fast and small utility that helps you to uninstall various software.

In addition:

  • ClumsyLeaf CloudXplorer -- To validate that files were being persisted as blobs within backup blob container, and associated blob metadata as well.
  • Fiddler Web Debugger -- Exceptionally helpful in validating RESTful access to Blob Service.

Recognition

Code Plex project Azure Storage Samples was exceptionally useful by providing a well implemented Blob Service REST API. I had implemented my own, but I found this one and liked it better.

History

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

jeff00seattle
Software Developer (Senior)
United States United States
I enjoy and take seriously the craft of programming, and I improve upon my skills daily. Start day: coffee is always a good idea!

Comments and Discussions

 
QuestionNot an article... PinmvpDave Kreskowiak15-Mar-13 15:30 
AnswerRe: Not an article... Pinmemberjeff00seattle20-Mar-13 20:18 
GeneralMy vote of 1 PinmemberdvptUml19-Jan-13 13:31 
BugRe: My vote of 1 [modified] Pinmemberjeff00seattle15-Mar-13 13:43 
AnswerRe: My vote of 1 Pinmemberjeff00seattle15-Mar-13 13:52 
QuestionFile not found Pinmemberwscan15-Dec-12 12:27 
BugRe: File not found [modified] Pinmemberjeff00seattle15-Mar-13 13:42 
AnswerRe: File not found Pinmemberjeff00seattle15-Mar-13 13:54 
Question{"The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security."} Pinmembersumitk.cadc23-Apr-12 22:40 
GeneralMy vote of 5 Pinmembermember6027-Feb-12 22:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 16 Mar 2013
Article Copyright 2012 by jeff00seattle
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid