你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Set-AzureSiteRecoveryVM
设置 Site Recovery 保护实体的恢复端选项。
注意
本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧 Azure 资源。 创建新的资源时,不建议使用此旧版 PowerShell 模块,因为 ASM 计划停用。 有关详细信息,请参阅 Azure Service Manager 停用。
Az PowerShell 模块是推荐的 PowerShell 模块,用于使用 PowerShell 管理 Azure 资源管理器 (ARM) 资源。
语法
Set-AzureSiteRecoveryVM
-VirtualMachine <ASRVirtualMachine>
[-Name <String>]
[-Size <String>]
[-PrimaryNic <String>]
[-RecoveryNetworkId <String>]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
说明
Set-AzureSiteRecoveryVM cmdlet 为 Azure Site Recovery 保护实体设置恢复端保护选项,例如恢复虚拟机大小和恢复虚拟机网络。
示例
示例 1:允许在受保护的虚拟机上进行更新
PS C:\> $ProtectionContainer = Get-AzureSiteRecoveryProtectionContainer
PS C:\> $VirtualMachines = Get-AzureSiteRecoveryVM -ProtectionContainer $ProtectionContainer
PS C:\> Set-AzureSiteRecoveryVM -VirtualMachine $VirtualMachines[0] -Name "NewVirtualMachine05"
Name :
ID : 8170d274-1e48-404a-b080-172ada140bc3
ClientRequestId : 09354052-8430-4fa8-9a35-63196dd4b2b4-2015-02-03 04:19:06Z-P
State : NotStarted
StateDescription : NotStarted
StartTime :
EndTime :
AllowedActions :
Tasks : {}
Errors : {}
第一个命令使用 Get-AzureSiteRecoveryProtectionContainer cmdlet 获取受保护的容器,然后将其存储在$ProtectionContainer变量中。
第二个命令使用 Get-AzureSiteRecoveryVM cmdlet 获取$ProtectionContainer中的虚拟机,然后将其存储在$VitrualMachines变量中。
最后一个命令允许更新名为 NewVirtualMachine05 的 $VitrualMachines 数组中的第一个虚拟机。
参数
-Name
指定目标虚拟机的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-PrimaryNic
指定主网络适配器卡。
类型: | 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 |
-RecoveryNetworkId
指定恢复网络 ID。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Size
指定目标虚拟机大小。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VirtualMachine
指定 Site Recovery 虚拟机对象。
类型: | ASRVirtualMachine |
Position: | Named |
默认值: | None |
必需: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |