< Back

Restore-AzureRmRecoveryServicesBackupItem

Tue Jan 29, 2019 10:00 pm

NAME Restore-AzureRmRecoveryServicesBackupItem



SYNOPSIS

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





SYNTAX

Restore-AzureRmRecoveryServicesBackupItem [-RecoveryPoint] <RecoveryPointBase> [-StorageAccountName] <String> [-StorageAccountResourceGroupName]

<String> [-DefaultProfile <IAzureContextContainer>] [-UseOriginalStorageAccount] [-Confirm] [-WhatIf] [<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.





PARAMETERS

-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-RecoveryPoint <RecoveryPointBase>

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

Get-AzureRmRecoveryServicesBackupRecoveryPoint cmdlet.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-StorageAccountName <String>

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.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-StorageAccountResourceGroupName <String>

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.



Required? true

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-UseOriginalStorageAccount [<SwitchParameter>]

Use this switch if the disks from the recovery point are to be restored to their original storage accounts.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

RecoveryPointBase

Parameter 'RecoveryPoint' accepts value of type 'RecoveryPointBase' from the pipeline





OUTPUTS

Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.JobBase







NOTES









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.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... backupitem

Backup-AzureRmRecoveryServicesBackupItem

Get-AzureRmRecoveryServicesBackupItem

Get-AzureRmRecoveryServicesBackupRecoveryPoint