Remove-AzVirtualNetwork

Applies to: Az.Network 1.2.0

Removes an Azure virtual network.

Syntax

Remove-AzVirtualNetwork
    -Name -string
    [-ResourceGroupName -string]
    [-Force]
    [-AsJob]
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Parameters

Name Description Required?
-Name Specifies the name of the virtual network to remove. Yes
-ResourceGroupName Specifies the name of the resource group for the virtual network. No
-Force Suppresses the confirmation message. No
-AsJob Run cmdlet in the background using job. No
-PassThru Returns the object that represents the virtual network that was removed. No
-WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run. No
-Confirm Prompts you for confirmation before running the cmdlet. No

Examples

Example 1: Remove a virtual network

# Removes the virtual network named VNet1 in the resource group Default-Networking-WestUS.
Remove-AzVirtualNetwork -Name 'VNet1' -ResourceGroupName 'Default-Networking-WestUS'

Example 2: Remove a virtual network without confirmation

# Removes the virtual network named VNet2 in the resource group ResourceGroup01 without prompting for confirmation.
Remove-AzVirtualNetwork -Name 'VNet2' -ResourceGroupName 'ResourceGroup01' -Force

Related Links