故障排除:无法在 Azure 中删除虚拟网络Troubleshooting: Failed to delete a virtual network in Azure

尝试在 Azure 中删除虚拟网络时,可能会收到错误。You might receive errors when you try to delete a virtual network in Azure. 本文提供解决此问题的故障排除步骤。This article provides troubleshooting steps to help you resolve this problem.

如果本文未解决你的 Azure 问题,请访问 MSDN 和 CSDN 上的 Azure 论坛。If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and CSDN. 可以在这些论坛上发布问题。You can post your issue in these forums. 还可提交 Azure 支持请求。You also can submit an Azure support request. 若要提交支持请求,请在 Azure 支持页上提交。To submit a support request, on the Azure support page.

故障排除指南Troubleshooting guidance

  1. 检查虚拟网络网关是否在虚拟网络中运行Check whether a virtual network gateway is running in the virtual network.
  2. 检查应用程序网关是否在虚拟网络中运行Check whether an application gateway is running in the virtual network.
  3. 检查 Azure Active Directory 域服务是否已在虚拟网络中启用Check whether Azure Active Directory Domain Service is enabled in the virtual network.
  4. 检查虚拟网络是否已连接到其他资源Check whether the virtual network is connected to other resource.
  5. 检查虚拟机是否仍在虚拟网络中运行Check whether a virtual machine is still running in the virtual network.
  6. 检查虚拟网络是否停滞在迁移状态Check whether the virtual network is stuck in migration.

疑难解答步骤Troubleshooting steps

检查虚拟网络网关是否在虚拟网络中运行Check whether a virtual network gateway is running in the virtual network

若要删除虚拟网络,首先必须删除虚拟网络网关。To remove the virtual network, you must first remove the virtual network gateway.

对于经典虚拟网络,请在 Azure 门户中转到经典虚拟网络的“概述”页。For classic virtual networks, go to the Overview page of the classic virtual network in the Azure portal. 在“VPN 连接”部分中,如果网关正在虚拟网络中运行,则会显示该网关的 IP 地址。In the VPN connections section, if the gateway is running in the virtual network, you will see the IP address of the gateway.

检查网关是否正在运行

对于虚拟网络,请转到虚拟网络的“概述”页。For virtual networks, go to the Overview page of the virtual network. 检查虚拟网络网关的“已连接设备”。Check Connected devices for the virtual network gateway.

Azure 门户中虚拟网络的已连接设备列表的屏幕截图。列表中突出显示了虚拟网络网关。

在删除网关之前,请先删除该网关中的所有“连接”对象。Before you can remove the gateway, first remove any Connection objects in the gateway.

检查应用程序网关是否在虚拟网络中运行Check whether an application gateway is running in the virtual network

转到虚拟网络的“概述”页。Go to the Overview page of the virtual network. 检查应用程序网关的“已连接设备”。Check the Connected devices for the application gateway.

Azure 门户中虚拟网络的已连接设备列表的屏幕截图。列表中突出显示了应用程序网关。

如果存在应用程序网关,则必须先将其删除,然后才能删除虚拟网络。If there is an application gateway, you must remove it before you can delete the virtual network.

检查 Azure Active Directory 域服务是否已在虚拟网络中启用Check whether Azure Active Directory Domain Service is enabled in the virtual network

如果 Active Directory 域服务已启用并已连接到虚拟网络,则无法删除此虚拟网络。If the Active Directory Domain Service is enabled and connected to the virtual network, you cannot delete this virtual network.

Azure 门户中 Azure AD 域服务屏幕的屏幕截图。突出显示了“在虚拟网络/子网中可用”字段。

若要禁用服务,请参阅使用 Azure 门户禁用 Azure Active Directory 域服务To disable the service, see Disable Azure Active Directory Domain Services using the Azure portal.

检查虚拟网络是否已连接到其他资源Check whether the virtual network is connected to other resource

检查线路链接、连接和虚拟网络对等互连。Check for Circuit Links, connections, and virtual network peerings. 其中的任何对象都可能导致虚拟网络删除失败。Any of these can cause a virtual network deletion to fail.

建议的删除顺序如下:The recommended deletion order is as follows:

  1. 网关连接Gateway connections
  2. 网关Gateways
  3. IPIPs
  4. 虚拟网络对等互连Virtual network peerings
  5. 应用服务环境 (ASE)App Service Environment (ASE)

检查虚拟机是否仍在虚拟网络中运行Check whether a virtual machine is still running in the virtual network

确保虚拟网络中没有任何虚拟机。Make sure that no virtual machine is in the virtual network.

检查虚拟网络是否停滞在迁移状态Check whether the virtual network is stuck in migration

如果虚拟网络停滞在迁移状态,则无法将其删除。If the virtual network is stuck in a migration state, it cannot be deleted. 请运行以下命令中止迁移,然后删除虚拟网络。Run the following command to abort the migration, and then delete the virtual network.

Move-AzureVirtualNetwork -VirtualNetworkName "Name" -Abort

后续步骤Next steps