Start-AzureSiteRecoveryTestFailoverJob
啟動 Site Recovery 保護實體的測試故障轉移。
注意
本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰。
Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。
語法
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
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-LogicalNetworkId
指定邏輯網路的識別碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-Network
指定要用於測試故障轉移的網路物件。 若要取得網路,請使用 Get-AzureSiteRecoveryNetwork Cmdlet。
類型: | ASRNetwork |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-NetworkType
指定要用於測試故障轉移的網路類型。 此參數可接受的值為:
- 無
- 新增
- Existing
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Profile
指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。
類型: | AzureSMProfile |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-ProtectionContainerId
指定受保護容器的標識碼。 此 Cmdlet 會針對屬於此 Cmdlet 所指定容器的受保護虛擬機啟動作業。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ProtectionEntity
指定 Site Recovery 保護實體物件。
類型: | ASRProtectionEntity |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ProtectionEntityId
指定要啟動作業之受保護虛擬機的標識碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-RecoveryPlan
指定要啟動作業的復原計劃。
類型: | ASRRecoveryPlan |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-RpId
指定要啟動作業之復原計劃的標識碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-VmNetworkId
指定虛擬機網路的識別碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-WaitForCompletion
表示 Cmdlet 會先等候作業完成,再將控制權傳回 Windows PowerShell 控制台。
類型: | SwitchParameter |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |