Start-AzureSiteRecoveryPlannedFailoverJob

Starts a Site Recovery planned failover operation.

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

Start-AzureSiteRecoveryPlannedFailoverJob
     -RPId <String>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryPlannedFailoverJob
     -ProtectionEntityId <String>
     -ProtectionContainerId <String>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryPlannedFailoverJob
     -RecoveryPlan <ASRRecoveryPlan>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryPlannedFailoverJob
     -ProtectionEntity <ASRProtectionEntity>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]

Description

The Start-AzureSiteRecoveryPlannedFailoverJob cmdlet starts a planned failover for an Azure Site Recovery protection entity or recovery plan. You can check whether the job succeeds by using the Get-AzureSiteRecoveryJob cmdlet.

Examples

Example 1: Start a planned failover job

PS C:\> $Container = Get-AzureSiteRecoveryProtectionContainer 
PS C:\> $Protected = Get-AzureSiteRecoveryProtectionEntity -ProtectionContainer $Container 
PS C:\> Start-AzureSiteRecoveryPlannedFailoverJob -Direction PrimaryToRecovery -ProtectionEntity $Protected -Optimize ForDowntime
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 all protected containers in the current Azure Site Recovery vault by using the Get-AzureSiteRecoveryProtectionContainer cmdlet, and then stores the results in the $Container variable. In this example, there is a single container.

The second command gets the protected 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 starts the failover job in the direction PrimaryToRecovery for the protected virtual machines stored in $Protected.

Parameters

-Direction

Specifies the direction of the failover. 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

-Optimize

Specifies what to optimize for. This parameter applies for failover from an Azure site to an on-premise site which requires a significant data synchronization. The acceptable values for this parameter are:

  • ForDowntime
  • ForSynchronization

When ForDowntime is specified, this indicates that data is synchronized before failover to minimize downtime. Synchronization is performed without shutting down the virtual machine. After synchronization is complete, the job is suspended. Resume the job to do an additional synchronization operation that shuts down the virtual machine.

When ForSynchronization is specified, this indicates that data is synchronized during failover only so data synchronization is minimized. Because this setting is enabled, the virtual machine is shut down immediately. Synchronization starts after shutdown to complete the failover operation.

Type:String
Position:Named
Default value:None
Required:False
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 the protected container for which to start the job.

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

-ProtectionEntity

Specifies the Site Recovery protection entity object.

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

-ProtectionEntityId

Specifies an ASRProtectionEntity object for which to start the job. To obtain an ASRProtectionEntity object, use the Get-AzureSiteRecoveryProtectionEntity cmdlet.

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 for which to start the job.

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