New-AzureRmRecoveryServicesAsrReplicationProtectedItem

Enables replication for an ASR protectable item by creating a replication protected item.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

New-AzureRmRecoveryServicesAsrReplicationProtectedItem
   [-VmmToVmm]
   -ProtectableItem <ASRProtectableItem>
   -Name <String>
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmRecoveryServicesAsrReplicationProtectedItem
   [-VMwareToAzure]
   -ProtectableItem <ASRProtectableItem>
   -Name <String>
   [-RecoveryVmName <String>]
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   -RecoveryAzureStorageAccountId <String>
   -Account <ASRRunAsAccount>
   [-LogStorageAccountId <String>]
   [-IncludeDiskId <String[]>]
   -ProcessServer <ASRProcessServer>
   [-RecoveryAzureNetworkId <String>]
   [-RecoveryAzureSubnetName <String>]
   -RecoveryResourceGroupId <String>
   [-ReplicationGroupName <String>]
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmRecoveryServicesAsrReplicationProtectedItem
   [-HyperVToAzure]
   -ProtectableItem <ASRProtectableItem>
   -Name <String>
   [-RecoveryVmName <String>]
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   -RecoveryAzureStorageAccountId <String>
   -RecoveryResourceGroupId <String>
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmRecoveryServicesAsrReplicationProtectedItem
   [-HyperVToAzure]
   -ProtectableItem <ASRProtectableItem>
   -Name <String>
   [-RecoveryVmName <String>]
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   -RecoveryAzureStorageAccountId <String>
   -OSDiskName <String>
   -OS <String>
   [-LogStorageAccountId <String>]
   [-IncludeDiskId <String[]>]
   [-RecoveryAzureNetworkId <String>]
   [-RecoveryAzureSubnetName <String>]
   -RecoveryResourceGroupId <String>
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmRecoveryServicesAsrReplicationProtectedItem
   [-AzureToAzure]
   -AzureToAzureDiskReplicationConfiguration <ASRAzuretoAzureDiskReplicationConfig[]>
   -AzureVmId <String>
   -Name <String>
   [-RecoveryVmName <String>]
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   -RecoveryResourceGroupId <String>
   [-RecoveryCloudServiceId <String>]
   [-RecoveryAvailabilitySetId <String>]
   [-RecoveryBootDiagStorageAccountId <String>]
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmRecoveryServicesAsrReplicationProtectedItem
   [-AzureToAzure]
   -AzureVmId <String>
   -Name <String>
   [-RecoveryVmName <String>]
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   [-RecoveryAzureStorageAccountId <String>]
   -LogStorageAccountId <String>
   -RecoveryResourceGroupId <String>
   [-RecoveryAvailabilitySetId <String>]
   [-RecoveryBootDiagStorageAccountId <String>]
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzureRmRecoveryServicesAsrReplicationProtectedItem cmdlet creates a new replication protected item. Use this cmdlet to enable replication for an ASR protectable item.

Examples

Example 1

PS C:\> $currentJob = New-AzureRmRecoveryServicesAsrReplicationProtectedItem -ProtectableItem $VM -Name $VM.Name -ProtectionContainerMapping $ProtectionContainerMapping

Starts the replication protected item creation operation for the specified ASR protectable item and returns the ASR job used to track the operation.

Example 2

PS C:\>$job = New-AzureRmRecoveryServicesAsrReplicationProtectedItem -ProtectableItem $pi -Name $rpiName -ProtectionContainerMapping $pcm `
-RecoveryAzureStorageAccountId $RecoveryAzureStorageAccountId -RecoveryResourceGroupId  $RecoveryResourceGroupId `
-ProcessServer $fabric.fabricSpecificDetails.ProcessServers[0] -Account $fabric.fabricSpecificDetails.RunAsAccounts[0]

Starts the replication protected item creation operation for the specified ASR protectable item and returns the ASR job used to track the operation(vmWare to Azure scenario).

Example 3

PS C:>$job = New-AzureRmRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureToAzureDiskReplicationConfig disk1,disk2 -AzureVmId $vmId `
-Name "a2aprotectedItem" -RecoveryVmName "vmName" -ProtectionContainerMapping $pcmMapping -RecoveryResourceGroupId $recoveryResourceGroup

Starts the replication protected item creation operation for the specified ASR protectable item and returns the ASR job used to track the operation (Azure to Azure scenario).

Example 4

PS C:\> $disk1 = new-AzureToAzureDiskReplicationConfiguration -vhdUri  $diskUri1 -RecoveryAzureStorageAccountId $recoveryAzureStorageAccountId `
-LogStorageAccountId $logStorageAccountId  
PS C:\> $disk2 = new-AzureToAzureDiskReplicationConfiguration -vhdUri  $diskUri2 -RecoveryAzureStorageAccountId $recoveryAzureStorageAccountId `
-LogStorageAccountId $logStorageAccountId  
PS C:\> $enableDRjob = New-AzureRmRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureVmId $vmId -Name $rpiName `
-RecoveryCloudServiceId  $recoveryCloudServiceId -ProtectionContainerMapping $pcm -RecoveryResourceGroupId  $RecoveryResourceGroupId `
-AzureToAzureDiskReplicationConfiguration $disk1,$disk2

Starts the replication protected item creation operation for the specified VmId and returns the ASR job used to track the operation (Azure to Azure scenario).

Parameters

-Account

The run as account to be used to push install the Mobility service if needed. Must be one from the list of run as accounts in the ASR fabric.

Type:ASRRunAsAccount
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-AzureToAzure

Switch parameter to specify that the replicated item is an Azure virtual machine replicating to a recovery Azure region.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AzureToAzureDiskReplicationConfiguration

Specifies the list of virtual machine disks to replicated and the cache storage account and recovery storage account to be used to replicate the disk.

Type:ASRAzuretoAzureDiskReplicationConfig[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-AzureVmId

Specifies the azure vm id to be replicated.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts for confirmation before starting the operation.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HyperVToAzure

Switch parameter to specify the replicated item is a Hyper-V virtual machine that is being replicated to Azure.

Type:SwitchParameter
Position:0
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IncludeDiskId

The list of disks to include for replication. By default all disks are included.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LogStorageAccountId

Specifies the log or cache storage account Id to be used to store replication logs.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies a name for the ASR replication protected item. The name must be unique within the vault.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-OS

Specifies the operating system family. The acceptable values for this parameter are: Windows or Linux.

Type:String
Accepted values:Windows, Linux
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-OSDiskName

Specifies the name of the operating system disk.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ProcessServer

The Process Server to use to replicate this machine. Use the list of process servers in the ASR fabric corresponding to the Configuration server to specify one.

Type:ASRProcessServer
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ProtectableItem

Specifies the ASR protectable item object for which replication is being enabled.

Type:ASRProtectableItem
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ProtectionContainerMapping

Specifies the ASR protection container mapping object corresponding to the replication policy to be used for replication.

Type:ASRProtectionContainerMapping
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RecoveryAvailabilitySetId

The ID of the AvailabilitySet to recover the machine to in the event of a failover.

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

-RecoveryAzureNetworkId

The ID of the Azure virtual network to recover the machine to in the event of a failover.

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

-RecoveryAzureStorageAccountId

Specifies the ID of the Azure storage account to replicate to.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RecoveryAzureSubnetName

The subnet within the recovery Azure virtual network to which the failed over virtual machine should be attached in the event of a failover.

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

-RecoveryBootDiagStorageAccountId

Specifies the storage account for boot diagnostics for recovery azure VM.

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

-RecoveryCloudServiceId

Specifies the resource ID of the recovery cloud service to failover this virtual machine to.

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

-RecoveryResourceGroupId

Specifies the ARM identifier of the resource group in which the virtual machine will be created in the event of a failover.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RecoveryVmName

Name of the recovery Vm created after failover.

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

-ReplicationGroupName

Specifies the replication group name to use to create multi-VM consistent recovery points. By default each replication protected item is created in a group of its own and multi-VM consistent recovery points are not generated. Use this option only if you need to create multi-VM consistent recovery points across a group of machines by protecting all machines to the same replication group.

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

-VmmToVmm

Switch parameter to specify the replicated item is a Hyper-V virtual machine that is being replicated between VMM managed Hyper-V sites.

Type:SwitchParameter
Position:0
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMwareToAzure

Switch parameter to specify the replicated item is a VMware virtual machine or physical server that will be replicate to Azure.

Type:SwitchParameter
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WaitForCompletion

Specifies that the cmdlet should wait for completion of the operation before returning.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

ASRProtectableItem

Outputs

ASRJob