Restore-​Azure​Rm​Recovery​Services​Backup​Item

Restores the data and configuration for a Backup item to a recovery point.

Syntax

Restore-AzureRmRecoveryServicesBackupItem
       [-RecoveryPoint] <RecoveryPointBase>
       [-StorageAccountName] <String>
       [-StorageAccountResourceGroupName] <String>
       [-InformationAction <ActionPreference>]
       [-InformationVariable <String>]
       [<CommonParameters>]

Description

The Restore-AzureRmRecoveryServicesBackupItem cmdlet restores the data and configuration for an Azure Backup item to a specified recovery point. This cmdlet starts the restore from the Recovery Services vault to customer's storage account.

The restore operation does not restore the full virtual machine. It restores the disk data and configuration information. After the restore operation is finished, you must create the virtual machine and start it.

Set the vault context by using the Set-AzureRmRecoveryServicesVaultContext cmdlet before you use the current cmdlet.

Examples

Example 1: Restore an item to a recovery point

PS C:\>$Container = Get-AzureRmRecoveryServicesBackupContainer -ContainerType AzureVM -Status Registered -Name "V2VM"
PS C:\> $BackupItem = Get-AzureRmRecoveryServicesBackupItem -ContainerType AzureVM -WorkloadType AzureVM 
PS C:\> $StartDate = (Get-Date).AddDays(-7) 
PS C:\> $EndDate = Get-Date
PS C:\> $RP = Get-AzureRmRecoveryServicesBackupRecoveryPoint -Item $BackupItem -StartDate $StartDate.ToUniversalTime() -EndDate $EndDate.ToUniversalTime() 
PS C:\> $RestoreJob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $RP[0] -StorageAccountName "DestAccount" -StorageAccountResourceGroupName "DestRG"
    WorkloadName    Operation       Status          StartTime              EndTime
    ------------    ---------       ------          ---------              -------
    V2VM            Restore         InProgress      26-Apr-16 1:14:01 PM   01-Jan-01 12:00:00 AM

The first command gets the Backup container of type AzureVM, and then stores it in the $Container variable.

The second command gets the Backup item named V2VM from $Container, and then stores it in the $BackupItem variable.

The third command gets the date from seven days earlier, and then stores it in the $StartDate variable.

The fourth command gets the current date, and then stores it in the $EndDate variable.

The fifth command gets a list of recovery points for the specific backup item filtered by $StartDate and $EndDate. The date range specified is the last 7 days.

The last command restores the disks to the target storage account DestAccount in the DestRG resource group.

Required Parameters

-RecoveryPoint

Specifies the recovery point to which to restore the virtual machine. To obtain an AzureRmRecoveryServicesBackupRecoveryPoint object, use the Get-AzureRmRecoveryServicesBackupRecoveryPoint cmdlet.

Type:RecoveryPointBase
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-StorageAccountName

Specifies the name of the target Storage account in your subscription. As a part of the restore process, this cmdlet stores the disks and the configuration information in this Storage account.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StorageAccountResourceGroupName

Specifies the name of the resource group that contains the target Storage account in your subscription. As a part of the restore process, this cmdlet stores the disks and the configuration information in this Storage account.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-InformationAction

Specifies how this cmdlet responds to an information event.The acceptable values for this parameter are:- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False