forked from Azure/Unreal-Pixel-Streaming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeleteAll.ps1
40 lines (31 loc) · 1.58 KB
/
DeleteAll.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
##Copyright (c) Microsoft Corporation.
## Licensed under the MIT license.
# This script is optional. This script has a variable called “$rootvariable” that should be set with the
# prefix of the environment that you want to destroy. For instance, in the current environment to destroy
# all assets that variable should be set to the first 5 random characters created in front of the resources
# to ensure uniqueness per deployment.
Param (
[Parameter(Mandatory = $True, HelpMessage = "root environment prefix")]
[String]$rootvariable = ""
)
#variables
#$rootvariable = "jk07k"
$vnetname = "jumpbox-vnet"
#$vnetname = "jumpbox-fork-vnet"
#script
#step 1 delete the resource groups
$r1 = $rootvariable + "-eastus-unreal-rg"
az group delete --name $r1 --no-wait --yes
$r2 = $rootvariable + "-westeurope-unreal-rg"
az group delete --name $r2 --no-wait --yes
$r3 = $rootvariable + "-westus-unreal-rg"
az group delete --name $r3 --no-wait --yes
$r4 = $rootvariable + "-southeastasia-unreal-rg"
az group delete --name $r4 --no-wait --yes
$r5 = $rootvariable + "-global-unreal-rg"
az group delete --name $r5 --no-wait --yes
#step 2 delete the resource peerings if they exist
az network vnet peering delete --name LinkVnet1ToVnet2 --resource-group OtherAssets --vnet-name $vnetname
az network vnet peering delete --name LinkVnet1ToVnet3 --resource-group OtherAssets --vnet-name $vnetname
az network vnet peering delete --name LinkVnet1ToVnet4 --resource-group OtherAssets --vnet-name $vnetname
az network vnet peering delete --name LinkVnet1ToVnet5 --resource-group OtherAssets --vnet-name $vnetname