将 ExpressRoute 关联的虚拟网络从经典部署模型迁移到 Resource Manager 部署模型Migrate ExpressRoute associated virtual networks from classic to Resource Manager

本文介绍如何在移动 ExpressRoute 线路后将 ExpressRoute 关联的虚拟网络从经典部署模型迁移到 Azure 资源管理器部署模型。This article explains how to migrate ExpressRoute-associated virtual networks from the classic deployment model to the Azure Resource Manager deployment model after moving your ExpressRoute circuit.

准备阶段Before you begin

Note

本文进行了更新,以便使用新的 Azure PowerShell Az 模块。This article has been updated to use the new Azure PowerShell Az module. 你仍然可以使用 AzureRM 模块,至少在 2020 年 12 月之前,它将继续接收 bug 修补程序。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要详细了解新的 Az 模块和 AzureRM 兼容性,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 有关 Az 模块安装说明,请参阅安装 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

支持的和不支持的方案Supported and unsupported scenarios

  • 可以在不停机的情况下,将 ExpressRoute 线路从经典环境移到 Resource Manager 环境。An ExpressRoute circuit can be moved from the classic to the Resource Manager environment without any downtime. 可以在不停机的情况下,将 ExpressRoute 线路从经典环境转移到 Resource Manager 环境。You can move any ExpressRoute circuit from the classic to the Resource Manager environment with no downtime. 按照相关说明,使用 PowerShell 将 ExpressRoute 线路从经典部署模型转移到资源管理器部署模型Follow the instructions in moving ExpressRoute circuits from the classic to the Resource Manager deployment model using PowerShell. 这是将连接的资源转移到虚拟网络的先决条件。This is a prerequisite to move resources connected to the virtual network.
  • 可以在不停机的情况下,将同一订阅中的虚拟网络、网关,以及附加到 ExpressRoute 线路的虚拟网络中的关联部署迁移到 Resource Manager 环境。Virtual networks, gateways, and associated deployments within the virtual network that are attached to an ExpressRoute circuit in the same subscription can be migrated to the Resource Manager environment without any downtime. 可以按照后面描述的步骤来迁移各种资源,例如虚拟网络、网关以及部署在虚拟网络中的虚拟机。You can follow the steps described later to migrate resources such as virtual networks, gateways, and virtual machines deployed within the virtual network. 必须确保虚拟网络配置正确,才能进行迁移。You must ensure that the virtual networks are configured correctly before they are migrated.
  • 若要完成虚拟网络、网关以及处于虚拟网络中但与 ExpressRoute 线路不属同一订阅的关联部署的迁移,则需停机一段时间。Virtual networks, gateways, and associated deployments within the virtual network that are not in the same subscription as the ExpressRoute circuit require some downtime to complete the migration. 文档最后一部分介绍了在迁移资源时必须执行的步骤。The last section of the document describes the steps to be followed to migrate resources.
  • 无法迁移使用 ExpressRoute 网关和 VPN 网关的虚拟网络。A virtual network with both ExpressRoute Gateway and VPN Gateway can't be migrated.
  • 不支持 ExpressRoute 线路跨订阅迁移。ExpressRoute circuit cross-subscription migration is not supported. 有关详细信息,请参阅 Microsoft.Network 移动支持For more information, see Microsoft.Network move support.

将 ExpressRoute 线路从经典部署模型转移到 Resource Manager 部署模型Move an ExpressRoute circuit from classic to Resource Manager

必须先将 ExpressRoute 线路从经典环境转移到 Resource Manager 环境,才能尝试迁移附加到 ExpressRoute 线路的资源。You must move an ExpressRoute circuit from the classic to the Resource Manager environment before you try to migrate resources that are attached to the ExpressRoute circuit. 若要完成此任务,请参阅以下文章:To accomplish this task, see the following articles:

此操作不涉及停机。This operation does not involve downtime. 只要迁移正在进行,就可以继续在本地和 Microsoft 之间传输数据。You can continue to transfer data between your premises and Microsoft while the migration is in progress.

迁移虚拟网络、网关和关联的部署Migrate virtual networks, gateways, and associated deployments

进行迁移时,需要执行哪些步骤取决于资源是在同一订阅中,还是在不同的订阅中,或者二者都有。The steps you follow to migrate depend on whether your resources are in the same subscription, different subscriptions, or both.

迁移与 ExpressRoute 线路属于同一订阅的虚拟网络、网关和关联的部署Migrate virtual networks, gateways, and associated deployments in the same subscription as the ExpressRoute circuit

此部分介绍了如何执行相关步骤,以便迁移与 ExpressRoute 线路属于同一订阅的虚拟网络、网关和关联的部署。This section describes the steps to be followed to migrate a virtual network, gateway, and associated deployments in the same subscription as the ExpressRoute circuit. 无需停机即可进行此迁移。No downtime is associated with this migration. 在整个迁移过程中,仍然可以使用所有资源。You can continue to use all resources through the migration process. 正在进行迁移时,管理平面是锁定的。The management plane is locked while the migration is in progress.

  1. 确保已将 ExpressRoute 线路从经典环境转移到 Resource Manager 环境。Ensure that the ExpressRoute circuit has been moved from the classic to the Resource Manager environment.

  2. 确保已针对迁移进行了相应的虚拟网络准备。Ensure that the virtual network has been prepared appropriately for the migration.

  3. 注册订阅,以便进行资源迁移。Register your subscription for resource migration. 若要针对资源迁移来注册订阅,请使用以下 PowerShell 代码片段:To register your subscription for resource migration, use the following PowerShell snippet:

    Select-AzSubscription -SubscriptionName <Your Subscription Name>
    Register-AzResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate
    Get-AzResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate
    
  4. 验证、准备和迁移。Validate, prepare, and migrate. 若要转移虚拟网络,请使用以下 PowerShell 代码片段:To move the virtual network, use the following PowerShell snippet:

    Move-AzureVirtualNetwork -Validate -VirtualNetworkName $vnetName
    Move-AzureVirtualNetwork -Prepare -VirtualNetworkName $vnetName
    Move-AzureVirtualNetwork -Commit -VirtualNetworkName $vnetName
    

    也可通过运行以下 PowerShell cmdlet 来中止迁移:You can also abort migration by running the following PowerShell cmdlet:

    Move-AzureVirtualNetwork -Abort $vnetName
    

后续步骤Next steps