你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Start-AzureSiteRecoveryTestFailoverJob

为 Site Recovery 保护实体启动测试故障转移。

注意

本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧 Azure 资源。 创建新的资源时,不建议使用此旧版 PowerShell 模块,因为 ASM 计划停用。 有关详细信息,请参阅 Azure Service Manager 停用

Az PowerShell 模块是推荐的 PowerShell 模块,用于使用 PowerShell 管理 Azure 资源管理器 (ARM) 资源。

语法

Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntityId <String>
     -ProtectionContainerId <String>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     -RpId <String>
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     -RpId <String>
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     [-WaitForCompletion]
     -LogicalNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     -RpId <String>
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     [-WaitForCompletion]
     -VmNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     -RpId <String>
     -Network <ASRNetwork>
     [-NetworkType <String>]
     -Direction <String>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     -Network <ASRNetwork>
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntity <ASRProtectionEntity>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     -Network <ASRNetwork>
     [-NetworkType <String>]
     -RecoveryPlan <ASRRecoveryPlan>
     -Direction <String>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     -Network <ASRNetwork>
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntityId <String>
     -ProtectionContainerId <String>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -RecoveryPlan <ASRRecoveryPlan>
     -Direction <String>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -RecoveryPlan <ASRRecoveryPlan>
     -Direction <String>
     [-WaitForCompletion]
     -LogicalNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -RecoveryPlan <ASRRecoveryPlan>
     -Direction <String>
     [-WaitForCompletion]
     -VmNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntityId <String>
     -ProtectionContainerId <String>
     [-WaitForCompletion]
     -LogicalNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntityId <String>
     -ProtectionContainerId <String>
     [-WaitForCompletion]
     -VmNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntity <ASRProtectionEntity>
     [-WaitForCompletion]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntity <ASRProtectionEntity>
     [-WaitForCompletion]
     -LogicalNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryTestFailoverJob
     [-Network <ASRNetwork>]
     [-NetworkType <String>]
     -Direction <String>
     -ProtectionEntity <ASRProtectionEntity>
     [-WaitForCompletion]
     -VmNetworkId <String>
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]

说明

Start-AzureSiteRecoveryTestFailoverJob cmdlet 启动 Azure Site Recovery 保护实体或恢复计划的测试故障转移。 可以使用 Get-AzureRMSiteRecoveryJob cmdlet 检查作业是否成功

示例

示例 1:启动测试故障转移

PS C:\> $ProtectionContainer = Get-AzureSiteRecoveryProtectionContainer
PS C:\> $ProtectionEntity = Get-AzureSiteRecoveryProtectionEntity -ProtectionContainer $ProtectionContainer
PS C:\> Start-AzureSiteRecoveryTestFailoverJob -ProtectionEntity $ProtectionEntity -Direction "PrimaryToRecovery"
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           : {}

第一个命令使用 Get-AzureSiteRecoveryProtectionContainer cmdlet 获取受保护的容器,然后将其存储在$ProtectionContainer变量中。

第二个命令使用 Get-AzureSiteRecoveryProtectionEntity cmdlet 获取属于存储在$ProtectionContainer中的受保护容器的受保护实体。 该命令将结果存储在$ProtectionEntity变量中。

最后一个命令为存储在$ProtectionEntity中的受保护实体启动测试故障转移操作,并指定故障转移的方向。

示例 2:使用恢复计划启动测试故障转移

PS C:\> $RecoveryPlan = Get-AzureSiteRecoveryRecoveryPlan -Name "RecoveryPlan01"
Start-AzureSiteRecoveryTestFailoverJob -Direction PrimaryToRecovery -RecoveryPlan $RecoveryPlan

此命令使用 Get-AzureSiteRecoveryRecoveryPlan cmdlet 获取名为 RecoveryPlan01 的恢复计划。 该命令将计划存储在$RecoveryPlan变量中。

第二个命令为存储在$RecoveryPlan中的恢复计划启动测试故障转移操作,并指定故障转移的方向。

参数

-Direction

指定故障转移方向。 此参数的可接受值为:

  • PrimaryToRecovery
  • RecoveryToPrimary
类型:String
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-LogicalNetworkId

指定逻辑网络的 ID。

类型:String
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-Network

指定要用于测试故障转移的网络对象。 若要获取网络,请使用 Get-AzureSiteRecoveryNetwork cmdlet。

类型:ASRNetwork
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-NetworkType

指定要用于测试故障转移的网络类型。 此参数的可接受值为:

  • 新建
  • Existing
类型:String
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

指定此 cmdlet 从中读取的 Azure 配置文件。 如果未指定配置文件,此 cmdlet 将从本地默认配置文件中读取。

类型:AzureSMProfile
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False

-ProtectionContainerId

指定受保护容器的 ID。 此 cmdlet 为属于此 cmdlet 指定的容器的受保护虚拟机启动作业。

类型:String
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-ProtectionEntity

指定 Site Recovery 保护实体对象。

类型:ASRProtectionEntity
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-ProtectionEntityId

指定要为其启动作业的受保护虚拟机的 ID。

类型:String
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-RecoveryPlan

指定要为其启动作业的恢复计划。

类型:ASRRecoveryPlan
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-RpId

指定要为其启动作业的恢复计划的 ID。

类型:String
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-VmNetworkId

指定虚拟机网络的 ID。

类型:String
Position:Named
默认值:None
必需:True
Accept pipeline input:False
Accept wildcard characters:False

-WaitForCompletion

指示该 cmdlet 等待操作完成,然后再将控制权返回到 Windows PowerShell 控制台。

类型:SwitchParameter
Position:Named
默认值:None
必需:False
Accept pipeline input:False
Accept wildcard characters:False