共用方式為


Update-AzureSiteRecoveryProtectionDirection

更新來源和目標伺服器,以保護 Site Recovery 物件。

注意

本檔中參考的 Cmdlet 用於管理使用服務管理 API 的舊版 Azure 資源。 如需管理 Azure Resource Manager 資源的 Cmdlet,請參閱 Az 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

Update-AzureSiteRecoveryProtectionDirection Cmdlet 會在認可容錯移轉作業完成之後,更新來源和目標伺服器來保護 Azure Site Recovery 物件。

範例

範例 1:修改容器中受保護物件的方向

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           : {}

第一個命令會使用 Get-AzureSiteRecoveryProtectionContainer Cmdlet 取得目前 Azure Site Recovery 保存庫中受保護的容器,然後將它儲存在 $Container 變數中。

第二個命令會使用 Get-AzureSiteRecoveryProtectionEntity Cmdlet,取得屬於儲存在 $Container 容器的虛擬機器。 命令會將結果儲存在 $Protected 變數中。

最後一個命令會將儲存在 $Protected 中之物件的 RecoverToPrimary 方向設定為 。

參數

-Direction

指定認可的方向。 此參數可接受的值為:

  • PrimaryToRecovery
  • RecoveryToPrimary
Type:String
Position:Named
Default value:None
Required:True
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 會修改屬於此參數所指定容器之受保護虛擬機器的方向。

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

-ProtectionEntity

指定保護實體物件。

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

-ProtectionEntityId

指定受保護虛擬機器的識別碼。 這個 Cmdlet 會修改此參數所指定受保護虛擬機器的方向。

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:True
Accept wildcard characters:False

-RPId

指定復原方案的識別碼。 這個 Cmdlet 會修改此參數所指定之復原計畫的方向。

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