Hi, I use command: Remove-AzureRmNetworkSecurityGroup -Name $nsg -ResourceGroupName $rg -Force | Set-AzureRmNetworkSecurityGroup, but gor error:
I guess the reason is because the networksecuritygroup associate with a subnet, I tried commandline:
Set-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $virtualnetwork -Name $subnet.Name -AddressPrefix $subnet.AddressPrefix | Set-AzureRmVirtualNetwork
but it does not work.
How can I remove the networksecuritygroup through script?