Inside Windows Azure Online Backup Using PowerShell Step-By-Step


Prerequisites – before we get started!

  1. For a complete list of Windows Azure Backup PowerShell cmdlets see: http://technet.microsoft.com/en-us/library/hh770400.aspx
  2. To Install Windows Azure Backup see Backup Windows Server Using Windows Azure Backup Step-By-Step
  3. To enable PowerShell for use with Windows Azure and Windows Azure Backup see: Install Windows Azure PowerShell Cmdlets Step-By-Step Connect to Windows Azure Includes Importing MSOnlineBackup Module

Scenarios / Tasks :

When working with the Windows Azure Backup [OB=OnlineBackup] system using PowerShell, you are working with objects for everything.  Keep that in mind as you play with and create your own scenarios or tasks. 

1)  Get a List of running Backup Jobs  and their current status:

     Get-OBJob 

2) Manage Azure Account from PowerShell

Add Azure Account:  Often people find they have multiple Azure accounts that they want to manage.  All accounts (first and subsequent) can be added using the Add-AzureAccount command.  This command will pop open a box asking for information needed to authenticate to the new account.  This is not needed if using certificate authentication.

    Add-AzureAccount

3) How do I authenticate with Windows Azure from PowerShell using a certificate?  

Please see Install Windows Azure PowerShell Cmdlets Step-By-Step Connect to Windows Azure Includes Importing MSOnlineBackup Module for full Step-By-Step Details

    Get-AzurePublishSettingsFile

    Import-AzurePublishSettingsFile C:UsersCampAdminDownloadsBizSpark-Pay-As-You-Go-1-28-2014-credentials.publishsettings

4)  How do I add the Windows Azure Online Backup cmdlets to PowerShell?

    Import-module MSOnlineBackup 

Agent must be installed first.  See Step-By-Step for more details 

5)  How do I see what Online Backup commands are available from PowerShell?

     get-command -module MSOnlineBackup

You will also want to update your help files to include all of the Online Backup cmdlets.  You can do this by running:
     Update-Help –module MSOnlineBackup

5)  How do I see what storage resources are being used for Online Backup?

    Get-OBMachineUsage

6) How do I see the status of a currently running job?

    Get-OBJob

7) How do I see what the current schedule is for my Online Backup?

    Get-OBPolicy | Get-OBSchedule

8) How do I see what files are being backed up?

    Get-OBPolicy  | get-OBFileSpec

If you want to save this information to a variable it would look like this…

    $fspec = Get-OBPolicy  | get-OBFileSpec
You could use this information to change the file specs using Set-OBFileSpec

9) How do I start an online backup backup using PowerShell?

     Get-OBPolicy | Start-OBBackup

The job should give you realtime feedback about the job, but you could also use Get-OBJob (in another window) to see the status.

10) How do I enable throttling on certain days or certain times?

     Set-OBMachineSetting -WorkDay “Mo”, “We” -StartWorkHour “9:00:00” -EndWorkHour “18:00:00” -WorkHourBandwidth (512*1024) -NonWorkHourBandwidth (2048*1024)

if you want to turn off throttling, you can Disable Throttling with:
     Set-OBMachineSetting –NoThrottle

11) How can I check the state of the current policy?

    Get-ObPolicy | Get-OBPolicyState 

12) How can I create a new policy? 

As of now, you cannot have multiple policies for a server so you will need to Remove-OBPolicy before creating a new one.  If you deployed the server and have not setup a profile yet, you can use PowerShell to setup the initial policy.  # Create new Policy
    $fspec = New-OBFileSpec –FileSpec C:UsersCampAdmin*.*
    $rpolicy = New-OBRetentionPolicy
    $sch = New-OBSchedule
    New-OBPolicy | Add-OBFileSpec -FileSPec $fspec | Set-OBRetentionPolicy -RetentionPolicy $rpolicy | Set-OBSchedule -Schedule $sch | Set-OBPolicy

 

Resources

Sample PowerShell Scrips working with Windows Azure http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Script-Sample-0daf6d9d 

Setting up PowerShell for use with Windows Azure Online Backup see: Install Windows Azure PowerShell Cmdlets Step-By-Step Connect to Windows Azure Includes Importing MSOnlineBackup Module

Install Windows Azure Online Backup see:

 

Windows Azure Online Backup Cmdlets in Windows PowerShell: 

http://technet.microsoft.com/en-us/library/hh770400.aspx