Update-AzureRmRecoveryServicesAsrProtectionDirection

Updates the replication direction for the specified replication protected item or recovery plan. Used to re-protect/reverse replicate a failed over replicated item or recovery plan.

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

Update-AzureRmRecoveryServicesAsrProtectionDirection
      -ReplicationProtectedItem <ASRReplicationProtectedItem>
      -Direction <String>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      [-AzureToVMware]
      [-Account <ASRRunAsAccount>]
      -DataStore <ASRDataStore>
      [-MasterTarget <ASRMasterTargetServer>]
      -ProcessServer <ASRProcessServer>
      -ProtectionContainerMapping <ASRProtectionContainerMapping>
      -ReplicationProtectedItem <ASRReplicationProtectedItem>
      -Direction <String>
      -RetentionVolume <ASRRetentionVolume>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      [-VMwareToAzure]
      -Account <ASRRunAsAccount>
      [-MasterTarget <ASRMasterTargetServer>]
      -ProcessServer <ASRProcessServer>
      -ProtectionContainerMapping <ASRProtectionContainerMapping>
      [-LogStorageAccountId <String>]
      [-RecoveryAzureStorageAccountId <String>]
      -ReplicationProtectedItem <ASRReplicationProtectedItem>
      -Direction <String>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      [-HyperVToAzure]
      [-LogStorageAccountId <String>]
      [-RecoveryAzureStorageAccountId <String>]
      -ReplicationProtectedItem <ASRReplicationProtectedItem>
      -Direction <String>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      [-VmmToVmm]
      -ReplicationProtectedItem <ASRReplicationProtectedItem>
      -Direction <String>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      [-AzureToAzure]
      -ProtectionContainerMapping <ASRProtectionContainerMapping>
      -LogStorageAccountId <String>
      [-RecoveryAzureStorageAccountId <String>]
      -ReplicationProtectedItem <ASRReplicationProtectedItem>
      [-RecoveryResourceGroupId <String>]
      [-RecoveryCloudServiceId <String>]
      [-RecoveryAvailabilitySetId <String>]
      [-RecoveryBootDiagStorageAccountId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      [-AzureToAzure]
      -ProtectionContainerMapping <ASRProtectionContainerMapping>
      -AzureToAzureDiskReplicationConfiguration <ASRAzuretoAzureDiskReplicationConfig[]>
      -ReplicationProtectedItem <ASRReplicationProtectedItem>
      [-RecoveryResourceGroupId <String>]
      [-RecoveryCloudServiceId <String>]
      [-RecoveryAvailabilitySetId <String>]
      [-RecoveryBootDiagStorageAccountId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      -RecoveryPlan <ASRRecoveryPlan>
      -Direction <String>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzureRmRecoveryServicesAsrProtectionDirection
      -Direction <String>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Update-AzureRmRecoveryServicesAsrProtectionDirection cmdlet updates the replication direction for the specified Azure Site Recovery object after the completion of a commit failover operation.

Examples

Example 1

PS C:\> $currentJob = Update-AzureRmRecoveryServicesAsrProtectionDirection -RecoveryPlan $RP -Direction PrimaryToRecovery

Start the update direction operation for the specified recovery plan and returns the ASR job object used to track the operation.

Example 2

PS C:\> $currentJob = Update-AzureRmRecoveryServicesAsrProtectionDirection -AzureToAzure -ProtectionContainerMapping $B2ApcmMapping -LogStorageAccountId $cacheStorageId `
 -ReplicationProtectedItem $rpi

Start the update direction operation for the specified replication protected item in target azure region defined by protection container mapping and using cache storage (in same region as VM).

Example 3

PS C:\> $currentJob = Update-AzureRmRecoveryServicesAsrProtectionDirection -AzureToAzure -ProtectionContainerMapping $B2ApcmMapping `
 -AzureToAzureDiskReplicationConfiguration $disk1,$disk2 -ReplicationProtectedItem  $rpi

Start the update direction operation for the specified replication protected item in target azure region defined by protection container mapping and provided disk replication configuration.

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 specifying that the replication direction being updated for replicated Azure virtual machines between two Azure regions.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
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

-AzureToVMware

Update replication direction from Azure to Vmware.

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

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DataStore

The VMware datastore to be used for the vmdisk's.

Type:ASRDataStore
Position:Named
Default value:None
Required:True
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

-Direction

Specifies the direction to be used for the update operation post a failover. The acceptable values for this parameter are:

  • PrimaryToRecovery
  • RecoveryToPrimary
Type:String
Accepted values:PrimaryToRecovery, RecoveryToPrimary
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-HyperVToAzure

Reprotect a Hyper-V virtual machine after failback.

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

-LogStorageAccountId

Specifies the storage account ID to store the replication log of VMs.

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

-MasterTarget

Master Target Server Details.

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

-ProcessServer

Process Server to be used for replication.

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

-ProtectionContainerMapping

Protection containerMapping to be used for replication.

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

-RecoveryAvailabilitySetId

The availability set that the virtual machine should be created in upon 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: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

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

-RecoveryPlan

Specifies an ASR recovery plan object.

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

-RecoveryResourceGroupId

Recovery resourceGroup id for protected Vm.

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

-ReplicationProtectedItem

Specifies an ASR replication protected item.

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

-RetentionVolume

Retention Volume on the master target server to be used.

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

-VmmToVmm

Update replication direction for a failed over Hyper-V virtual machine that is protected between two VMM managed Hyper-V sites.

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

-VMwareToAzure

Update replication direction from VMware to Azure.

Type:SwitchParameter
Position:0
Default value:None
Required:True
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

ASRRecoveryPlan

Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRReplicationProtectedItem

Outputs

ASRJob