Skip to content

Latest commit

 

History

History
114 lines (80 loc) · 3.44 KB

Remove-AzVirtualNetworkSubnetConfig.md

File metadata and controls

114 lines (80 loc) · 3.44 KB
external help file Module Name ms.assetid online version schema
Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml
Az.Network
47FE9EF4-6000-4096-8F04-26A0C6661FDB
2.0.0

Remove-AzVirtualNetworkSubnetConfig

SYNOPSIS

Removes a subnet configuration from a virtual network.

SYNTAX

Remove-AzVirtualNetworkSubnetConfig [-Name <String>] -VirtualNetwork <PSVirtualNetwork>
 [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]

DESCRIPTION

The Remove-AzVirtualNetworkSubnetConfig cmdlet removes a subnet from an Azure virtual network.

EXAMPLES

1: Remove a subnet from a virtual network and update the virtual network

New-AzResourceGroup -Name TestResourceGroup -Location centralus
$frontendSubnet = New-AzVirtualNetworkSubnetConfig -Name frontendSubnet -AddressPrefix "10.0.1.0/24"

$backendSubnet = New-AzVirtualNetworkSubnetConfig -Name backendSubnet -AddressPrefix "10.0.2.0/24"

$virtualNetwork = New-AzVirtualNetwork -Name MyVirtualNetwork -ResourceGroupName TestResourceGroup -Location centralus -AddressPrefix "10.0.0.0/16" -Subnet $frontendSubnet,$backendSubnet

Remove-AzVirtualNetworkSubnetConfig -Name backendSubnet -VirtualNetwork $virtualNetwork
$virtualNetwork | Set-AzVirtualNetwork

This example creates a resource group and a virtual network with two subnets. It then uses the Remove-AzVirtualNetworkSubnetConfig command to remove the backend subnet from the in-memory representation of the virtual network. Set-AzVirtualNetwork is then called to modify the virtual network on the server side.

PARAMETERS

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

Specifies the name of the subnet configuration to remove.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-VirtualNetwork

Specifies the VirtualNetwork object that contains the subnet configuration to remove.

Type: Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork

OUTPUTS

Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork

NOTES

RELATED LINKS

Add-AzVirtualNetworkSubnetConfig

Get-AzVirtualNetworkSubnetConfig

New-AzVirtualNetworkSubnetConfig

Set-AzVirtualNetworkSubnetConfig