Azure PowerShell Reference

Remove-AzVirtualNetworkSubnetConfig

Removes a subnet configuration from a virtual network configuration.

Syntax

Remove-AzVirtualNetworkSubnetConfig -Name [-VirtualNetwork] [-PassThru] [-Force] [-AsJob] [-WhatIf] [-Confirm] []

Parameters

Name Type Description
-Name String Specifies the name of the subnet configuration to remove.
-VirtualNetwork PSObject Specifies the virtual network configuration from which to remove the subnet. This parameter accepts a virtual network object.
-PassThru SwitchParameter Returns the removed subnet configuration.
-Force SwitchParameter Skips the confirmation prompt.
-AsJob SwitchParameter Runs the cmdlet as a background job.
-WhatIf SwitchParameter Shows what would happen if the cmdlet runs. The cmdlet is not run.
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.

Examples

Description Command
Remove a subnet named 'Subnet1' from a virtual network configuration. $vnet = Get-AzVirtualNetwork -Name "VNet1" -ResourceGroupName "ResourceGroup1"
Remove-AzVirtualNetworkSubnetConfig -Name "Subnet1" -VirtualNetwork $vnet
Remove a subnet named 'Subnet2' without prompting for confirmation. $vnet = Get-AzVirtualNetwork -Name "VNet2" -ResourceGroupName "ResourceGroup2"
Remove-AzVirtualNetworkSubnetConfig -Name "Subnet2" -VirtualNetwork $vnet -Force

Notes

This cmdlet removes a subnet configuration from a virtual network object in memory. To apply these changes to Azure, you need to use the Set-AzVirtualNetwork cmdlet.

Related Links