Update-AzureSiteRecoveryProtectionDirection

Updates the source and target server for the protection of a Site Recovery object.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Update-AzureSiteRecoveryProtectionDirection
      -RecoveryPlan <ASRRecoveryPlan>
      -Direction <String>
      [-WaitForCompletion]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]
Update-AzureSiteRecoveryProtectionDirection
      -RPId <String>
      -Direction <String>
      [-WaitForCompletion]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]
Update-AzureSiteRecoveryProtectionDirection
      -ProtectionEntityId <String>
      -ProtectionContainerId <String>
      -Direction <String>
      [-WaitForCompletion]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]
Update-AzureSiteRecoveryProtectionDirection
      -ProtectionEntity <ASRProtectionEntity>
      -Direction <String>
      [-WaitForCompletion]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]

Description

The Update-AzureSiteRecoveryProtectionDirection cmdlet updates the source and target server for the protection of an Azure Site Recovery object after a commit failover operation finishes.

Examples

Example 1: Modify the direction for a protected object in a container

PS C:\> $Container = Get-AzureSiteRecoveryProtectionContainer 
PS C:\> $Protected = Get-AzureSiteRecoveryProtectionEntity -ProtectionContainer $Container  
PS C:\> Update-AzureSiteRecoveryProtectionDirection -Direction RecoveryToPrimary -ProtectionEntity $Protected 
ID               : c38eecdc-731c-405b-a61c-08db99aae2fe
ClientRequestId  : 32ace403-0916-4967-83a1-529176bd6e88-2014-49-06 15:49:24Z-P
State            : NotStarted
StateDescription : NotStarted
StartTime        : 
EndTime          : 
AllowedActions   : {}
Name             : 
Tasks            : {}
Errors           : {}

The first command gets the protected containers in the current Azure Site Recovery vault by using the Get-AzureSiteRecoveryProtectionContainer cmdlet, and then stores it in the $Container variable.

The second command gets the virtual machines that belong to the container stored in $Container by using the Get-AzureSiteRecoveryProtectionEntity cmdlet. The command stores the results in the $Protected variable.

The final command sets the direction to RecoverToPrimary for the objects stored in $Protected.

Parameters

-Direction

Specifies the direction of the commit. The acceptable values for this parameter are:

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

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

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

-ProtectionContainerId

Specifies the ID of a protected container. This cmdlet modifies the direction for a protected virtual machine that belongs to the container that this parameter specifies.

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

-ProtectionEntity

Specifies the protection entity object.

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

-ProtectionEntityId

Specifies the ID of a protected virtual machine. This cmdlet modifies the direction for the protected virtual machine that this parameter specifies.

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

-RecoveryPlan

Specifies a recovery plan object.

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

-RPId

Specifies the ID of a recovery plan. This cmdlet modifies the direction for the recovery plan that this parameter specifies.

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

-WaitForCompletion

Indicates that the cmdlet waits for the operation to complete before it returns control to the Windows PowerShell console.

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