简体   繁体   中英

Remove multiple vnet peers azure CLI

I have a requirement to remove and recreate 24 peers from two separate VNETS.

2 different subscriptions, 2 different VNETs. the peering all in the same vnet -

12 in PRD

12 in DEV

I am hoping to automate this process. What is the best approach to accomplish this? The main goal is to automate and make the script/template portable.

AZ CLI, ARM Template, PowerShell?

Thanks for your feedback

In this case, you could use Azure PowerShell or Azure CLI to remove the vnet peering.

Azure PowerShell: Remove-AzVirtualNetworkPeering

Remove-AzVirtualNetworkPeering -Name "myVnet1TomyVnet2" -VirtualNetworkName "myVnet" -ResourceGroupName "myResourceGroup"

Azure CLI: az network vnet peering delete

az network vnet peering delete -g MyResourceGroup -n MyVnet1ToMyVnet2 --vnet-name MyVnet1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM