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

Rajesh T 21 Reputation points
2020-12-02T13:42:33.43+00:00

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,509 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 111.3K Reputation points MVP
    2020-12-02T14:24:00.363+00:00

    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)

    Regards
    Andreas Baumgarten

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.