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

Update-AzureSiteRecoveryProtectionDirection

更新源服务器和目标服务器以保护 Site Recovery 对象。

注意

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

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

语法

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

说明

提交故障转移操作完成后, 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
类型:String
Position:Named
默认值:None
必需:True
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 修改属于此参数指定的容器的受保护虚拟机的方向。

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

-ProtectionEntity

指定保护实体对象。

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

-ProtectionEntityId

指定受保护虚拟机的 ID。 此 cmdlet 修改此参数指定的受保护虚拟机的方向。

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

-RecoveryPlan

指定恢复计划对象。

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

-RPId

指定恢复计划的 ID。 此 cmdlet 修改此参数指定的恢复计划的方向。

类型: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