建立、變更或刪除虛擬網路Create, change, or delete a virtual network

注意

本文已更新為使用 Azure Az PowerShell 模組。This article has been updated to use the Azure Az PowerShell module. Az PowerShell 模組是用來與 Azure 互動的建議 PowerShell 模組。The Az PowerShell module is the recommended PowerShell module for interacting with Azure. 若要開始使用 Az PowerShell 模組,請參閱安裝 Azure PowerShellTo get started with the Az PowerShell module, see Install Azure PowerShell. 若要瞭解如何遷移至 Az PowerShell 模組,請參閱將 Azure PowerShell 從 AzureRM 遷移至 Az。To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

了解如何建立和刪除虛擬網路以及變更現有虛擬網路的設定,例如 DNS 伺服器和 IP 位址空間。Learn how to create and delete a virtual network and change settings, like DNS servers and IP address spaces, for an existing virtual network. 如果您不熟悉虛擬網路,則可以在虛擬網路概觀中或透過完成教學課程來深入了解。If you're new to virtual networks, you can learn more about them in the Virtual network overview or by completing a tutorial. 虛擬網路包含子網路。A virtual network contains subnets. 若要了解如何建立、變更和刪除子網路,請參閱管理子網路To learn how to create, change, and delete subnets, see Manage subnets.

開始之前Before you begin

在完成本文任一節的步驟之前,請先完成下列工作︰Complete the following tasks before completing steps in any section of this article:

  • 如果您還沒有 Azure 帳戶,請註冊免費試用帳戶If you don't already have an Azure account, sign up for a free trial account.
  • 如果使用入口網站,請開啟 https://portal.azure.com,並使用您的 Azure 帳戶來登入。If using the portal, open https://portal.azure.com, and log in with your Azure account.
  • 如果使用 PowerShell 命令來完成這篇文章中的工作,請在 Azure Cloud Shell (英文) 中執行命令,或從您的電腦執行 PowerShell。If using PowerShell commands to complete tasks in this article, either run the commands in the Azure Cloud Shell, or by running PowerShell from your computer. Azure Cloud Shell 是免費的互動式 Shell,可讓您用來執行本文中的步驟。The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. 它具有預先安裝和設定的共用 Azure 工具,可與您的帳戶搭配使用。It has common Azure tools preinstalled and configured to use with your account. 本教學課程需要 Azure PowerShell 模組 1.0.0 版或更新版本。This tutorial requires the Azure PowerShell module version 1.0.0 or later. 執行 Get-Module -ListAvailable Az 來了解安裝的版本。Run Get-Module -ListAvailable Az to find the installed version. 如果您需要升級,請參閱安裝 Azure PowerShell 模組If you need to upgrade, see Install Azure PowerShell module. 如果您在本機執行 PowerShell,則也需要執行 Connect-AzAccount 以建立與 Azure 的連線。If you are running PowerShell locally, you also need to run Connect-AzAccount to create a connection with Azure.
  • 如果使用命令列介面 (CLI) 命令來完成這篇文章中的工作,請在 Azure Cloud Shell (英文) 中執行命令,或從您的電腦執行 CLI。If using Azure Command-line interface (CLI) commands to complete tasks in this article, either run the commands in the Azure Cloud Shell, or by running the CLI from your computer. 本教學課程需要 Azure CLI 2.0.31 版或更新版本。This tutorial requires the Azure CLI version 2.0.31 or later. 執行 az --version 來了解安裝的版本。Run az --version to find the installed version. 如果您需要安裝或升級,請參閱安裝 Azure CLIIf you need to install or upgrade, see Install Azure CLI. 如果您在本機執行 Azure CLI,則也需要執行 az login 以建立與 Azure 的連線。If you are running the Azure CLI locally, you also need to run az login to create a connection with Azure.
  • 您登入或連線到 Azure 的帳戶必須指派給「網路參與者」角色,或指派給已獲指派 [許可權] 中所列適當動作的自訂角色The account you log into, or connect to Azure with, must be assigned to the network contributor role or to a custom role that is assigned the appropriate actions listed in Permissions.

建立虛擬網路Create a virtual network

  1. 選取 [ + 建立資源 > 網路 > 虛擬網路]。Select + Create a resource > Networking > Virtual network.
  2. 輸入或選取下列設定的值,然後選取 [ 建立]:Enter or select values for the following settings, then select Create:
    • 名稱:您選取用來建立虛擬網路的 資源群組名稱必須是唯一的。Name: The name must be unique in the resource group that you select to create the virtual network in. 虛擬網路建立後,就不能再變更其名稱。You cannot change the name after the virtual network is created. 您可以隨著時間建立多個虛擬網路。You can create multiple virtual networks over time. 如需命名建議,請參閱命名慣例For naming suggestions, see Naming conventions. 下列命名慣例有協助於輕鬆管理多個虛擬網路。Following a naming convention can help make it easier to manage multiple virtual networks.

    • 位址空間:虛擬網路的位址空間由一或多個以 CIDR 標記法指定的非重疊位址範圍所組成。Address space: The address space for a virtual network is composed of one or more non-overlapping address ranges that are specified in CIDR notation. 您可以定義公用或私人的位址範圍 (RFC 1918)。The address range you define can be public or private (RFC 1918). 不論您定義的是公用或私人的位址範圍,您都只能從虛擬網路、互連的虛擬網路,以及任何已連線到虛擬網路的內部部署網路來連線到位址空間。Whether you define the address range as public or private, the address range is reachable only from within the virtual network, from interconnected virtual networks, and from any on-premises networks that you have connected to the virtual network. 您無法新增下列位址範圍︰You cannot add the following address ranges:

      • 224.0.0.0/4 (多點傳送)224.0.0.0/4 (Multicast)
      • 255.255.255.255/32 (廣播)255.255.255.255/32 (Broadcast)
      • 127.0.0.0/8 (回送)127.0.0.0/8 (Loopback)
      • 169.254.0.0/16 (連結-本機)169.254.0.0/16 (Link-local)
      • 168.63.129.16/32 (內部 DNS、DHCP 和 Azure Load Balancer 健康情況探查)168.63.129.16/32 (Internal DNS, DHCP, and Azure Load Balancer health probe)

      雖然當您在入口網站中建立虛擬網路時,只能定義一個位址範圍,但您可以在建立虛擬網路之後,將更多位址範圍新增至位址空間中。Although you can define only one address range when you create the virtual network in the portal, you can add more address ranges to the address space after the virtual network is created. 若要了解如何將位址範圍新增至現有的虛擬網路,請參閱新增或移除位址範圍To learn how to add an address range to an existing virtual network, see Add or remove an address range.

      警告

      如果虛擬網路具有與另一個虛擬網路或內部部署網路重迭的位址範圍,則無法連接這兩個網路。If a virtual network has address ranges that overlap with another virtual network or on-premises network, the two networks can't be connected. 在您定義位址範圍之前,請考慮未來是否想要將該虛擬網路連線到其他虛擬網路或內部部署網路。Before you define an address range, consider whether you might want to connect the virtual network to other virtual networks or on-premises networks in the future. Microsoft 建議使用私人位址空間或您組織所擁有的公用位址空間來設定虛擬網路位址範圍。Microsoft recommends configuring virtual network address ranges with private address space or public address space owned by your organization.

      • 子網路名稱:子網路名稱在虛擬網路內必須是唯一的。Subnet name: The subnet name must be unique within the virtual network. 子網路建立後,就不能再變更子網路名稱。You cannot change the subnet name after the subnet is created. 當您在建立虛擬網路時,即使虛擬網路不一定要擁有任何子網路,但入口網站仍會要求您定義一個子網路。The portal requires that you define one subnet when you create a virtual network, even though a virtual network isn't required to have any subnets. 在入口網站中,您可以在建立虛擬網路時定義一個或多個子網。In the portal, you can define one or more subnets when you create a virtual network. 建立虛擬網路之後,您可以將更多子網路新增至虛擬網路。You can add more subnets to the virtual network later, after the virtual network is created. 若要將子網路新增至虛擬網路,請參閱管理子網路To add a subnet to a virtual network, see Manage subnets. 您可以使用 Azure CLI 或 PowerShell,建立具有多個子網路的虛擬網路。You can create a virtual network that has multiple subnets by using Azure CLI or PowerShell.

        提示

        有時候,系統管理員會建立不同的子網路來篩選或控制在子網路之間傳送的流量。Sometimes, administrators create different subnets to filter or control traffic routing between the subnets. 在定義子網路之前,請先考慮您想要如何篩選和路由傳送子網路之間的流量。Before you define subnets, consider how you might want to filter and route traffic between your subnets. 若要深入了解如何篩選子網路之間的流量,請參閱網路安全性群組To learn more about filtering traffic between subnets, see Network security groups. Azure 會自動路由傳送子網路之間的流量,但您可以覆寫 Azure 預設路由。Azure automatically routes traffic between subnets, but you can override Azure default routes. 若要深入了解 Azures 預設子網路流量路由,請參閱路由概觀To learn more about Azures default subnet traffic routing, see Routing overview.

      • 子網路位址範圍︰此範圍必須位於您針對虛擬網路輸入的位址空間內。Subnet address range: The range must be within the address space you entered for the virtual network. 您可以指定的最小範圍是 /29,此範圍可提供八個 IP 位址供子網路使用。The smallest range you can specify is /29, which provides eight IP addresses for the subnet. 為了符合通訊協定的規定,Azure 會保留每個子網路中的第一個和最後一個位址。Azure reserves the first and last address in each subnet for protocol conformance. Azure 還會保留三個位址供 Azure 服務使用。Three additional addresses are reserved for Azure service usage. 因此,使用 /29 子網路位址範圍的虛擬網路只有三個可用的 IP 位址。As a result, a virtual network with a subnet address range of /29 has only three usable IP addresses. 如果您打算將虛擬網路連線至 VPN 閘道,則必須建立一個閘道子網路。If you plan to connect a virtual network to a VPN gateway, you must create a gateway subnet. 深入了解閘道子網路位址範圍的具體考量Learn more about specific address range considerations for gateway subnets. 若符合特定條件,您可以在子網路建立好之後變更其位址範圍。You can change the address range after the subnet is created, under specific conditions. 若要了解如何變更子網路的位址範圍,請參閱管理子網路To learn how to change a subnet address range, see Manage subnets.

      • 用帳戶:選取 用帳戶。Subscription: Select a subscription. 您無法在多個 Azure 訂用帳戶中使用相同的虛擬網路。You cannot use the same virtual network in more than one Azure subscription. 不過,您可以利用虛擬網路對等互連,將某個訂用帳戶中的虛擬網路連線至其他訂用帳戶中的虛擬網路。However, you can connect a virtual network in one subscription to virtual networks in other subscriptions with virtual network peering. 您連線到虛擬網路的任何 Azure 資源必須與虛擬網路位於相同的訂用帳戶中。Any Azure resource that you connect to the virtual network must be in the same subscription as the virtual network.

      • 資源群組:選取現有的 資源群組 ,或建立一個新的群組。Resource group: Select an existing resource group or create a new one. 您連線到虛擬網路的 Azure 資源,可以位於與虛擬網路相同或不同的資源群組中。An Azure resource that you connect to the virtual network can be in the same resource group as the virtual network or in a different resource group.

      • 位置︰選取 Azure 位置 (也稱為區域)。Location: Select an Azure location, also known as a region. 虛擬網路只能位於一個 Azure 位置。A virtual network can be in only one Azure location. 不過,您可以使用 VPN 閘道,將某個位置的虛擬網路連線至其他位置的虛擬網路。However, you can connect a virtual network in one location to a virtual network in another location by using a VPN gateway. 您連線到虛擬網路的任何 Azure 資源必須與虛擬網路位於相同的位置。Any Azure resource that you connect to the virtual network must be in the same location as the virtual network.

命令Commands

檢視虛擬網路與設定View virtual networks and settings

  1. 在入口網站頂端的搜尋方塊中輸入「虛擬網路」。In the search box at the top of the portal, enter virtual networks in the search box. 當搜尋結果中出現 虛擬網路 時加以選取。When Virtual networks appear in the search results, select it.
  2. 在虛擬網路清單中,選取您想要檢視設定的虛擬網路。From the list of virtual networks, select the virtual network that you want to view settings for.
  3. 您所選虛擬網路會列出如下設定︰The following settings are listed for the virtual network you selected:
    • 概觀︰提供虛擬網路的相關資訊,包括位址空間和 DNS 伺服器。Overview: Provides information about the virtual network, including address space and DNS servers. 下列螢幕擷取畫面顯示名為 MyVNet 之虛擬網路的概觀設定:The following screenshot shows the overview settings for a virtual network named MyVNet:

      網路介面概觀

      您可以選取 [資源群組] 或 [訂用帳戶名稱] 旁的 [變更],將虛擬網路移至不同的訂用帳戶或資源群組。You can move a virtual network to a different subscription or resource group by selecting Change next to Resource group or Subscription name. 若要了解如何移動虛擬網路,請參閱將資源移到不同的資源群組或訂用帳戶To learn how to move a virtual network, see Move resources to a different resource group or subscription. 該文會列出必要條件,以及如何使用 Azure 入口網站、PowerShell 和 Azure CLI 來移動資源。The article lists prerequisites, and how to move resources by using the Azure portal, PowerShell, and Azure CLI. 所有連線至虛擬網路的資源都必須隨著虛擬網路移動。All resources that are connected to the virtual network must move with the virtual network.

    • 位址空間︰這裡會列出指派給虛擬網路的位址空間。Address space: The address spaces that are assigned to the virtual network are listed. 若要了解如何將位址範圍新增至位址空間和從中移除,請完成新增或移除位址範圍中的步驟。To learn how to add and remove an address range to the address space, complete the steps in Add or remove an address range.

    • 已連線的裝置︰這裡會列出任何與虛擬網路連線的資源。Connected devices: Any resources that are connected to the virtual network are listed. 在上述螢幕擷取畫面中,有三個網路介面和一個負載平衡器連線到虛擬網路。In the preceding screenshot, three network interfaces and one load balancer are connected to the virtual network. 您建立並連線到虛擬網路的任何新資源都會在此列出。Any new resources that you create and connect to the virtual network are listed. 如果您刪除已連線到虛擬網路的資源,清單中就不會再顯示該資源。If you delete a resource that was connected to the virtual network, it no longer appear in the list.

    • 子網路︰虛擬網路中現存的子網路清單會在此顯示。Subnets: A list of subnets that exist within the virtual network is shown. 若要了解如何新增和移除子網路,請參閱管理子網路To learn how to add and remove a subnet, see Manage subnets.

    • DNS 伺服器︰您可以指定由 Azure 的內部 DNS 伺服器或自訂 DNS 伺服器來為連線到虛擬網路的裝置提供名稱解析。DNS servers: You can specify whether the Azure internal DNS server or a custom DNS server provides name resolution for devices that are connected to the virtual network. 在使用 Azure 入口網站建立虛擬網路時,虛擬網路預設會使用 Azure 的 DNS 伺服器來解析名稱。When you create a virtual network by using the Azure portal, Azure's DNS servers are used for name resolution within a virtual network, by default. 若要修改 DNS 伺服器,請完成本文變更 DNS 伺服器中的步驟。To modify the DNS servers, complete the steps in Change DNS servers in this article.

    • 對等互連︰如果訂用帳戶中已有對等互連,這裡便會列出。Peerings: If there are existing peerings in the subscription, they are listed here. 您可以檢視現有對等互連的設定,也可以建立、變更或刪除對等互連。You can view settings for existing peerings, or create, change, or delete peerings. 若要深入了解對等互連,請參閱虛擬網路對等互連To learn more about peerings, see Virtual network peering.

    • 屬性︰顯示虛擬網路的相關設定,包括虛擬網路的資源識別碼及其所在的訂用帳戶。Properties: Displays settings about the virtual network, including the virtual network's resource ID and the Azure subscription it is in.

    • 圖表︰此圖表會以視覺方式來呈現所有連線到虛擬網路的裝置。Diagram: The diagram provides a visual representation of all devices that are connected to the virtual network. 此圖表包含有關裝置的一些重要資訊。The diagram has some key information about the devices. 若要在此檢視中管理裝置,請在圖表中選取裝置。To manage a device in this view, in the diagram, select the device.

    • 一般 Azure 設定:若要深入了解 Azure 的一般設定,請參閱下列資訊:Common Azure settings: To learn more about common Azure settings, see the following information:

命令Commands

新增或移除位址範圍Add or remove an address range

您可以新增和移除虛擬網路的位址範圍。You can add and remove address ranges for a virtual network. 位址範圍必須以 CIDR 標記法來指定,而且同一個虛擬網路中的位址範圍不能重疊。An address range must be specified in CIDR notation, and cannot overlap with other address ranges within the same virtual network. 您可以定義公用或私人的位址範圍 (RFC 1918)。The address ranges you define can be public or private (RFC 1918). 不論您定義的是公用或私人的位址範圍,您都只能從虛擬網路、互連的虛擬網路,以及任何已連線到虛擬網路的內部部署網路來連線到位址空間。Whether you define the address range as public or private, the address range is reachable only from within the virtual network, from interconnected virtual networks, and from any on-premises networks that you have connected to the virtual network.

只要虛擬網路仍包含任何相關聯子網的範圍,您就可以減少該虛擬網路的位址範圍。You can decrease the address range for a virtual network as long as it still includes the ranges of any associated subnets. 此外,您可以擴充位址範圍,例如,將/16 變更為/8。Additionally, you can extend the address range, for example, changing a /16 to /8.

您無法新增下列位址範圍︰You cannot add the following address ranges:

  • 224.0.0.0/4 (多點傳送)224.0.0.0/4 (Multicast)
  • 255.255.255.255/32 (廣播)255.255.255.255/32 (Broadcast)
  • 127.0.0.0/8 (回送)127.0.0.0/8 (Loopback)
  • 169.254.0.0/16 (連結-本機)169.254.0.0/16 (Link-local)
  • 168.63.129.16/32 (內部 DNS、DHCP 和 Azure Load Balancer 健康情況探查)168.63.129.16/32 (Internal DNS, DHCP, and Azure Load Balancer health probe)

新增或移除位址範圍:To add or remove an address range:

  1. 在入口網站頂端的搜尋方塊中輸入「虛擬網路」。In the search box at the top of the portal, enter virtual networks in the search box. 當搜尋結果中出現 虛擬網路 時加以選取。When Virtual networks appear in the search results, select it.
  2. 從虛擬網路清單中,選取您要新增或移除位址範圍的虛擬網路。From the list of virtual networks, select the virtual network for which you want to add or remove an address range.
  3. 在 [設定] 底下,選取 [位址空間]。Select Address space, under SETTINGS.
  4. 完成下列其中一個選項:Complete one of the following options:
    • 新增位址範圍︰輸入新的位址範圍。Add an address range: Enter the new address range. 此位址範圍不能與虛擬網路已定義的現有位址範圍重疊。The address range cannot overlap with an existing address range that is defined for the virtual network.
    • 移除位址範圍:在您想要移除的位址範圍的右側,選取 [...],然後選取 [移除]。Remove an address range: On the right of the address range you want to remove, select ..., then select Remove. 如果位址範圍有現存的子網路,您就無法移除該位址範圍。If a subnet exists in the address range, you cannot remove the address range. 若要移除位址範圍,您必須先刪除位址範圍中存在的任何子網路 (以及子網路中的任何資源)。To remove an address range, you must first delete any subnets (and any resources in the subnets) that exist in the address range.
  5. 選取 [儲存]。Select Save.

命令Commands

變更 DNS 伺服器Change DNS servers

所有連線至虛擬網路的 VM 會向您為虛擬網路指定的 DNS 伺服器註冊。All VMs that are connected to the virtual network register with the DNS servers that you specify for the virtual network. 他們也可使用指定的 DNS 伺服器進行名稱解析。They also use the specified DNS server for name resolution. VM 中的每個網路介面 (NIC) 都可以有自己的 DNS 伺服器設定。Each network interface (NIC) in a VM can have its own DNS server settings. 如果 NIC 有自己的 DNS 伺服器設定,其設定就會覆寫虛擬網路的 DNS 伺服器設定。If a NIC has its own DNS server settings, they override the DNS server settings for the virtual network. 若要深入了解 NIC DNS 設定,請參閱網路介面工作和設定To learn more about NIC DNS settings, see Network interface tasks and settings. 若要深入了解 Azure 雲端服務中 VM 和角色執行個體的名稱解析,請參閱 VM 和角色執行個體的名稱解析To learn more about name resolution for VMs and role instances in Azure Cloud Services, see Name resolution for VMs and role instances. 若要新增、變更或移除 DNS 伺服器:To add, change, or remove a DNS server:

  1. 在入口網站頂端的搜尋方塊中輸入「虛擬網路」。In the search box at the top of the portal, enter virtual networks in the search box. 當搜尋結果中出現 虛擬網路 時加以選取。When Virtual networks appear in the search results, select it.
  2. 從虛擬網路清單中,選取您要變更 DNS 伺服器的虛擬網路。From the list of virtual networks, select the virtual network for which you want to change DNS servers for.
  3. 在 [設定] 下選取 [ DNS 伺服器]。Select DNS servers, under SETTINGS.
  4. 選取下列其中一個選項:Select one of the following options:
    • 預設 (Azure 提供的):所有資源名稱和私人 IP 位址都會自動註冊到 Azure DNS 伺服器。Default (Azure-provided): All resource names and private IP addresses are automatically registered to the Azure DNS servers. 您可以在連線到相同虛擬網路的任何資源之間解析名稱。You can resolve names between any resources that are connected to the same virtual network. 您無法使用此選項來跨虛擬網路解析名稱。You cannot use this option to resolve names across virtual networks. 若要跨虛擬網路解析名稱,您必須使用自訂 DNS 伺服器。To resolve names across virtual networks, you must use a custom DNS server.
    • 自訂︰您可以為虛擬網路新增一或多部伺服器,數量可達 Azure 的限制。Custom: You can add one or more servers, up to the Azure limit for a virtual network. 若要深入了解 DNS 伺服器限制,請參閱 Azure 限制To learn more about DNS server limits, see Azure limits. 下列選項可供您選擇:You have the following options:
    • 新增地址︰將伺服器新增至虛擬網路 DNS 伺服器清單。Add an address: Adds the server to your virtual network DNS servers list. 此選項也會向 Azure 註冊 DNS 伺服器。This option also registers the DNS server with Azure. 如果您已向 Azure 註冊 DNS 伺服器,即可在清單中選取該 DNS 伺服器。If you've already registered a DNS server with Azure, you can select that DNS server in the list.
    • 移除位址︰在您想要移除的伺服器旁,選取 [...],然後選取 [移除]。Remove an address: Next to the server that you want to remove, select ..., then Remove. 刪除伺服器只會從此虛擬網路清單中移除伺服器。Deleting the server removes the server only from this virtual network list. DNS 伺服器會在 Azure 中保持登錄狀態,以便您其他的虛擬網路使用。The DNS server remains registered in Azure for your other virtual networks to use.
    • 將 DNS 伺服器位址重新排序︰請務必要確認,您為環境所列出的 DNS 伺服器順序是正確的。Reorder DNS server addresses: It's important to verify that you list your DNS servers in the correct order for your environment. DNS 伺服器清單會依其指定的順序來使用。DNS server lists are used in the order that they are specified. 它們不會當作循環配置資源設定運作。They do not work as a round-robin setup. 如果清單上的第一部 DNS 伺服器是可以連線的,用戶端就會使用該 DNS 伺服器,而不管該 DNS 伺服器是否有正常運作。If the first DNS server in the list can be reached, the client uses that DNS server, regardless of whether the DNS server is functioning properly. 請移除所有列出的 DNS 伺服器,再以您想要的順序重新新增。Remove all the DNS servers that are listed, and then add them back in the order that you want.
    • 變更位址:將清單中的 DNS 伺服器醒目提示,然後輸入新位址。Change an address: Highlight the DNS server in the list, and then enter the new address.
  5. 選取 [儲存]。Select Save.
  6. 將連線到虛擬網路的 VM 重新啟動,讓這些 VM 獲得新的 DNS 伺服器設定。Restart the VMs that are connected to the virtual network, so they are assigned the new DNS server settings. 這些 VM 會繼續使用其目前的 DNS 設定,直到您將其重新啟動。VMs continue to use their current DNS settings until they are restarted.

命令Commands

刪除虛擬網路Delete a virtual network

您只能刪除未連線任何資源的虛擬網路。You can delete a virtual network only if there are no resources connected to it. 如果有資源連線至虛擬網路中的任何子網路,您必須先刪除虛擬網路中所有子網路的已連線資源。If there are resources connected to any subnet within the virtual network, you must first delete the resources that are connected to all subnets within the virtual network. 不同資源的資源刪除步驟也各異。The steps you take to delete a resource vary depending on the resource. 若要了解如何刪除已連線至子網路的資源,請閱讀您想要刪除之各個資源類型的適用文件。To learn how to delete resources that are connected to subnets, read the documentation for each resource type you want to delete. 若要刪除虛擬網路:To delete a virtual network:

  1. 在入口網站頂端的搜尋方塊中輸入「虛擬網路」。In the search box at the top of the portal, enter virtual networks in the search box. 當搜尋結果中出現 虛擬網路 時加以選取。When Virtual networks appear in the search results, select it.
  2. 從虛擬網路清單中,選取您要刪除的虛擬網路。From the list of virtual networks, select the virtual network you want to delete.
  3. 請在 [設定] 底下,選取 [連接的裝置],確認沒有任何裝置連線到虛擬網路。Confirm that there are no devices connected to the virtual network by selecting Connected devices, under SETTINGS. 如果有已連線的裝置,您必須先將其刪除,才能刪除虛擬網路。If there are connected devices, you must delete them before you can delete the virtual network. 如果沒有連接的裝置,請選取 [概觀]。If there are no connected devices, select Overview.
  4. 選取 [刪除]。Select Delete.
  5. 若要確認刪除虛擬網路,請選取 [是]。To confirm the deletion of the virtual network, select Yes.

命令Commands

權限Permissions

若要針對虛擬網路執行工作,您的帳戶必須指派為網路參與者角色,或為已指派下表中所列適當動作的自訂角色:To perform tasks on virtual networks, your account must be assigned to the network contributor role or to a custom role that is assigned the appropriate actions listed in the following table:

動作Action NameName
Microsoft.Network/virtualNetworks/readMicrosoft.Network/virtualNetworks/read 讀取虛擬網路Read a virtual Network
Microsoft.Network/virtualNetworks/writeMicrosoft.Network/virtualNetworks/write 建立或更新虛擬網路Create or update a virtual network
Microsoft.Network/virtualNetworks/deleteMicrosoft.Network/virtualNetworks/delete 刪除虛擬網路Delete a virtual network

下一步Next steps