Hi am newbi to azure , what is the best method for remove subnet in azure using powershell?

Rajesh T 21 Reputation points

Remove-AzVirtualNetworkSubnetConfig -Name backendSubnet -VirtualNetwork

> $virtualNetwork
> $virtualNetwork | Set-AzVirtualNetwork

Getting error in above script . can some one help me .
thanks in adavance

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,129 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 95,336 Reputation points MVP

    Maybe this helps:

    $vnet = Get-AzVirtualNetwork -Name <NameOfTheVirtualNetwork> -ResourceGroupName <NameOfTheResourceGroup>
    Remove-AzVirtualNetworkSubnetConfig -Name <NameOfTheSubnet> -VirtualNetwork $vnet
    $vnet | Set-AzVirtualNetwork

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Andreas Baumgarten

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful