-
Notifications
You must be signed in to change notification settings - Fork 7
/
05_02_Deploy_Bastion.azurecli
36 lines (27 loc) · 1.12 KB
/
05_02_Deploy_Bastion.azurecli
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
#Define Deployment Variables
appNamePrefix='tws'
locationDetails=$(cat locationDetails.json)
#Deploy Public IP Address
location=$(echo $locationDetails | jq -c '.[] | select(.Region | match("Primary")) | .Location' -r)
resourceGroupName="${appNamePrefix}-iaas-${location}"
pipName="$appNamePrefix-pip-bastion-$location"
az network public-ip create \
--name ${pipName} \
--resource-group ${resourceGroupName} \
--location ${location} \
--allocation-method Static \
--sku Standard
#Deploy Azure Bastion
location=$(echo $locationDetails | jq -c '.[] | select(.Region | match("Primary")) | .Location' -r)
resourceGroupName="${appNamePrefix}-iaas-${location}"
vNet=$(az network vnet list --resource-group ${resourceGroupName})
vNetName=$(echo $vNet | jq '.[0].name' -r)
pip=$(az network public-ip list --resource-group ${resourceGroupName})
pipName=$(echo $pip | jq '.[0].name' -r)
bastionName="${appNamePrefix}-bastion-${location}"
az network bastion create \
--name ${bastionName} \
--resource-group ${resourceGroupName} \
--location ${location} \
--vnet-name ${vNetName} \
--public-ip-address ${pipName}