将虚拟网络（经典）从地缘组迁移到区域Migrate a virtual network (classic) from an affinity group to a region
Azure 具有用于创建和处理资源的两个不同的部署模型：资源管理器部署模型和经典部署模型。Azure has two different deployment models for creating and working with resources: Resource Manager and classic. 本文介绍使用经典部署模型的情况。This article covers using the classic deployment model. Azure 建议大多数新部署使用 Resource Manager 部署模型。Azure recommends that most new deployments use the Resource Manager deployment model.
地缘组确保在相同地缘组中创建的资源由彼此靠近的服务器实际托管，从而加快这些资源的通信速度。Affinity groups ensure that resources created within the same affinity group are physically hosted by servers that are close together, enabling these resources to communicate quicker. 过去，地缘组是创建虚拟网络（经典）的必要条件。In the past, affinity groups were a requirement for creating virtual networks (classic). 当时，托管虚拟网络（经典）的网络管理器服务只能在一组物理服务器或缩放单元内工作。At that time, the network manager service that managed virtual networks (classic) could only work within a set of physical servers or scale unit. 体系结构改进已将网络管理的范畴扩大到了区域。Architectural improvements have increased the scope of network management to a region.
由于这些体系结构的改进，不再建议或需要对虚拟网络（经典）使用地缘组。As a result of these architectural improvements, affinity groups are no longer recommended, or required for virtual networks (classic). 现在，对虚拟网络（经典）使用地缘组的做法已被区域取代。The use of affinity groups for virtual networks (classic) is replaced by regions. 与区域关联的虚拟网络（经典）称为区域虚拟网络。Virtual networks (classic) that are associated with regions are called regional virtual networks.
我们建议在一般情况下不要使用地缘组。We recommend that you don't use affinity groups in general. 除了虚拟网络要求外，使用地缘组来确保计算（经典）和存储（经典）等资源的位置相互靠近同样重要。Aside from the virtual network requirement, affinity groups were also important to use to ensure resources, such as compute (classic) and storage (classic), were placed near each other. 但是，对于当前的 Azure 网络体系结构，不再需要满足这些位置要求。However, with the current Azure network architecture, these placement requirements are no longer necessary.
尽管从技术上讲仍可以创建与地缘组关联的虚拟网络，但是，没有令人信服的理由让人这么做。Although it is still technically possible to create a virtual network that is associated with an affinity group, there is no compelling reason to do so. 许多虚拟网络功能，例如网络安全组，仅当使用区域虚拟网络时才可用，而不能用于与地缘组关联的虚拟网络。Many virtual network features, such as network security groups, are only available when using a regional virtual network, and are not available for virtual networks that are associated with affinity groups.
编辑网络配置文件Edit the network configuration file
导出网络配置文件。Export the network configuration file. 若要了解如何使用 PowerShell 或 Azure 命令行接口 (CLI) 1.0 导出网络配置文件，请参阅使用网络配置文件配置虚拟网络。To learn how to export a network configuration file using PowerShell or the Azure command-line interface (CLI) 1.0, see Configure a virtual network using a network configuration file.
Location 是已为与虚拟网络（经典）关联的地缘组指定的区域。The Location is the region that you specified for the affinity group that is associated with your virtual network (classic). 例如，如果虚拟网络（经典）与位于中国北部的地缘组关联，则在迁移时，Location 必须指向中国北部。For example, if your virtual network (classic) is associated with an affinity group that is located in China North, when you migrate, your Location must point to China North.
编辑网络配置文件中的以下行，将相应值替换成自己的值：Edit the following lines in your network configuration file, replacing the values with your own:
旧值： <VirtualNetworkSitename="VNetChinsNorth" AffinityGroup="VNetDemoAG">Old value: <VirtualNetworkSitename="VNetChinsNorth" AffinityGroup="VNetDemoAG">
新值： <VirtualNetworkSitename="VNetChinsNorth" Location="China North">New value: <VirtualNetworkSitename="VNetChinsNorth" Location="China North">
此迁移不会导致你的服务出现任何停机情况。This migration does NOT cause any downtime to your services.
如果在地缘组中有一个 VM（经典）该怎么办What to do if you have a VM (classic) in an affinity group
当前位于地缘组中的 VM（经典）不需要从地缘组中删除。VMs (classic) that are currently in an affinity group do not need to be removed from the affinity group. 在 VM 部署后，系统会将其部署到单个缩放单元。Once a VM is deployed, it is deployed to a single scale unit. 地缘组可以限制可用于新 VM 部署的 VM 大小集，但是部署的任何现有 VM 已限制为在其中部署该 VM 的缩放单元中可用的 VM 大小集。Affinity groups can restrict the set of available VM sizes for a new VM deployment, but any existing VM that is deployed is already restricted to the set of VM sizes available in the scale unit in which the VM is deployed. 由于该 VM 已部署到缩放单元，因此，从地缘组中删除该 VM 不会对 VM 产生影响。Because the VM is already deployed to a scale unit, removing a VM from an affinity group has no effect on the VM.