Created
June 18, 2019 19:43
-
-
Save dstarr/045f42a5113fc77fd60708cd10c3e7da to your computer and use it in GitHub Desktop.
Provisions an app gateway and a scale set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
set -e | |
location="westus2" | |
resource_group="dms-dev-10-rg" | |
ag_be_gw="dms-ag-backend-gw" | |
ag_be_pool="dms-ag-backend-pool" | |
ag_public_ip="dms-ag-public-ip" | |
ag_subnet="dms-app-gw-subnet" | |
ag="dms-app-gateway" | |
be_subnet="dms-backend-subnet" | |
ss_name="dms-scale-set" | |
vnet_name="dms-vnet" | |
# Create a resource group | |
echo "az group create" | |
az group create --name $resource_group --location $location | |
# Create network resources | |
echo "az network vnet create" | |
az network vnet create \ | |
--name $vnet_name \ | |
--resource-group $resource_group \ | |
--location $location \ | |
--address-prefix 10.0.0.0/16 \ | |
--subnet-name $ag_subnet \ | |
--subnet-prefix 10.0.1.0/24 | |
echo "az network vnet subnet create" | |
az network vnet subnet create \ | |
--name $be_subnet \ | |
--resource-group $resource_group \ | |
--vnet-name $vnet_name \ | |
--address-prefix 10.0.2.0/24 | |
echo "az network public-ip create" | |
az network public-ip create \ | |
--resource-group $resource_group \ | |
--name $ag_public_ip | |
# Create the application gateway | |
echo "az network application-gateway create" | |
az network application-gateway create \ | |
--name $ag \ | |
--location $location \ | |
--resource-group $resource_group \ | |
--vnet-name $vnet_name \ | |
--subnet $ag_subnet \ | |
--capacity 2 \ | |
--sku Standard_Medium \ | |
--http-settings-cookie-based-affinity Disabled \ | |
--frontend-port 80 \ | |
--http-settings-port 80 \ | |
--http-settings-protocol Http \ | |
--public-ip-address $ag_public_ip | |
# Install NGINX | |
echo "az vmss extension set" | |
az vmss extension set \ | |
--publisher Microsoft.Azure.Extensions \ | |
--version 2.0 \ | |
--name CustomScript \ | |
--resource-group $resource_group \ | |
--vmss-name $ss_name \ | |
--settings '{ "fileUris": ["https://raw.githubusercontent.com/davidmu1/samplescripts/master/install_nginx.sh"], "commandToExecute": "./install_nginx.sh" }' | |
# Get the IP address | |
echo "az network public-ip show" | |
az network public-ip show \ | |
--resource-group $resource_group \ | |
--name $ag_public_ip \ | |
--query [ipAddress] \ | |
--output tsv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code, when running in my Azure account, dies during step "#######".
It emits the following error: