共用方式為


Start-AzureSiteRecoveryTestFailoverJob

啟動 Site Recovery 保護實體的測試容錯移轉。

注意

本檔中參考的 Cmdlet 用於管理使用服務管理 API 的舊版 Azure 資源。 如需管理 Azure Resource Manager 資源的 Cmdlet,請參閱 Az PowerShell 模組

Syntax

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>]

Description

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,取得目前 Azure Site Recovery 保存庫名為 RecoveryPlan01 的復原方案。 命令會將計畫儲存在 $RecoveryPlan 變數中。

第二個命令會針對儲存在 $RecoveryPlan 中的復原計畫啟動測試容錯移轉作業,並指定容錯移轉的方向。

參數

-Direction

指定容錯移轉方向。 此參數可接受的值為:

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

-LogicalNetworkId

指定邏輯網路的識別碼。

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

-Network

指定要用於測試容錯移轉的網路物件。 若要取得網路,請使用 Get-AzureSiteRecoveryNetwork Cmdlet。

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

-NetworkType

指定要用於測試容錯移轉的網路類型。 此參數可接受的值為:

  • 新增
  • Existing
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設設定檔讀取。

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

-ProtectionContainerId

指定受保護容器的識別碼。 此 Cmdlet 會針對屬於此 Cmdlet 所指定容器的受保護虛擬機器啟動作業。

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

-ProtectionEntity

指定 Site Recovery 保護實體物件。

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

-ProtectionEntityId

指定要啟動作業之受保護虛擬機器的識別碼。

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

-RecoveryPlan

指定要啟動作業的復原計畫。

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

-RpId

指定要啟動作業之復原計畫的識別碼。

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

-VmNetworkId

指定虛擬機器網路的識別碼。

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

-WaitForCompletion

表示 Cmdlet 會先等候作業完成,再將控制權傳回 Windows PowerShell 主控台。

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