forked from dmauser/AzureVM-Router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploylinuxnva.azcli
28 lines (24 loc) · 1.47 KB
/
deploylinuxnva.azcli
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
##parameters#
rg="nva-lab" #set your resource group
location=centralus #set your Azure region
username=azureuser
password=Msft123Msft123
vnetname=vnet1
subnetname=nvasubnet
nvaname=linux-nva
#Resource Group
az group create --name $rg --location $location
## Create VNET and NVA
az network vnet create --resource-group $rg --name $vnetname --location $location --address-prefixes 10.1.0.0/16 --subnet-name $subnetname --subnet-prefix 10.1.10.0/24 -o none
az network vnet subnet create --address-prefix 10.1.0.0/24 --name nvasubnet --resource-group $rg --vnet-name $vnetname -o none
# NVA + Config script to enable NAT
az network public-ip create --name $nvaname-pip --resource-group $rg --location $location --allocation-method Dynamic
az network nic create --name $nvaname-nic --resource-group $rg --subnet $subnetname --vnet $vnetname --public-ip-address $nvaname-pip --ip-forwarding true -o none
az vm create --resource-group $rg --location $location --name $nvaname --size Standard_B1s --nics $nvaname-nic --image UbuntuLTS --admin-username $username --admin-password $password -o none
# Enable routing and NAT on Linux NVA:
scripturi="https://raw.githubusercontent.com/dmauser/AzureVM-Router/master/linuxrouter.sh"
az vm extension set --resource-group $rg --vm-name $nvaname --name customScript --publisher Microsoft.Azure.Extensions \
--protected-settings "{\"fileUris\": [\"$scripturi\"],\"commandToExecute\": \"./linuxrouter.sh\"}" \
--no-wait
#Clean up
az group delete -g $rg --no-wait --yes