New-AzRecoveryServicesAsrReplicationProtectedItem

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

Syntax

New-AzRecoveryServicesAsrReplicationProtectedItem
   [-VmmToVmm]
   -ProtectableItem <ASRProtectableItem>
   -Name <String>
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzRecoveryServicesAsrReplicationProtectedItem
   [-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-AzRecoveryServicesAsrReplicationProtectedItem
   [-HyperVToAzure]
   -ProtectableItem <ASRProtectableItem>
   -Name <String>
   [-RecoveryVmName <String>]
   -ProtectionContainerMapping <ASRProtectionContainerMapping>
   -RecoveryAzureStorageAccountId <String>
   -RecoveryResourceGroupId <String>
   [-WaitForCompletion]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzRecoveryServicesAsrReplicationProtectedItem
   [-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-AzRecoveryServicesAsrReplicationProtectedItem
   [-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-AzRecoveryServicesAsrReplicationProtectedItem
   [-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-AzRecoveryServicesAsrReplicationProtectedItem 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-AzRecoveryServicesAsrReplicationProtectedItem -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-AzRecoveryServicesAsrReplicationProtectedItem -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-AzRecoveryServicesAsrReplicationProtectedItem -AzToAzure -AzToAzureDiskReplicationConfig disk1,disk2 -AzVmId $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-AzToAzureDiskReplicationConfiguration -vhdUri  $diskUri1 -RecoveryAzureStorageAccountId $recoveryAzureStorageAccountId `
-LogStorageAccountId $logStorageAccountId  
PS C:\> $disk2 = new-AzToAzureDiskReplicationConfiguration -vhdUri  $diskUri2 -RecoveryAzureStorageAccountId $recoveryAzureStorageAccountId `
-LogStorageAccountId $logStorageAccountId  
PS C:\> $enableDRjob = New-AzRecoveryServicesAsrReplicationProtectedItem -AzToAzure -AzVmId $vmId -Name $rpiName `
-RecoveryCloudServiceId  $recoveryCloudServiceId -ProtectionContainerMapping $pcm -RecoveryResourceGroupId  $RecoveryResourceGroupId `
-AzToAzureDiskReplicationConfiguration $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:Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRRunAsAccount
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-AzureToAzure

{{Fill AzureToAzure Description}}

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

{{Fill AzureToAzureDiskReplicationConfiguration Description}}

Type:Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRAzuretoAzureDiskReplicationConfig[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-AzureVmId

{{Fill AzureVmId Description}}

Type:String
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-IncludeDiskId

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

Type:System.String[]
Position:Named
Default value:None
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
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
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
Accept pipeline input:False
Accept wildcard characters:False
-OSDiskName

Specifies the name of the operating system disk.

Type:String
Position:Named
Default value:None
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:Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRProcessServer
Position:Named
Default value:None
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
Accept pipeline input:True (ByValue)
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
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
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
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
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
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
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
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
Accept pipeline input:False
Accept wildcard characters:False
-RecoveryVmName

Name of the recovery Vm created after failover.

Type:String
Position:Named
Default value:None
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
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
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
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
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
Accept pipeline input:False
Accept wildcard characters:False

Inputs

ASRProtectableItem

Outputs

ASRJob