• 1 min read

PowerShell Script Sample: Backup & Restore on Windows Azure Iaas

Backup and Restore is critical to operate real world systems.   In this article I will walk you through the process to backup and restore Windows Server system disk from a VM running in the…

Backup and Restore is critical to operate real world systems.   In this article I will walk you through the process to backup and restore Windows Server system disk from a VM running in the Windows Azure IaaS environment using PowerShell.    

Follow these instructions to backup and restore Windows Server system disk from a VM running in the Windows Azure IaaS environment using PowerShell.

For information about other methods for Backup and Restore, read “How to Backup and Restore Windows Systems Disk on Windows Azure IaaS”.

The Copy Blob operation itself will finish within a few seconds for a 127GB Windows System disk.

The Basic process in this sample scripts is as follows.

Backup

  1. Shutdown VM.
  2. Copy VHD to the backup location.
  3. Start VM.

Restore

  1. Shutdown VM.
  2. Remove VM.
  3. Remove VHD.
  4. Copy VHD.
  5. Make VM.
  6. Start VM.

In this sample, I am assuming there is a target VM in a virtual network. Also this scripts are only for Windows system disk and having a dependency on local file systems of where this script is executed from. There is no error handling code in the script. You should be aware that the error handling code you will need depends on your environment. Also these scripts are assuming Service Name and VMname as parameters. And this restore script also assumes a VM exists before restore operations are executed. 

Sample script – backup.ps1

Sample Script – restore.ps1 


Contributors: Nozomu Hirose, Juergen Thomas, Nicholas Dritsas, James Podgorski, Gaurav Gupta, Sanjay Mishra, Dan Reger