Skip to content

Instantly share code, notes, and snippets.

@dstarr dstarr/provision.sh
Created Jun 18, 2019

Embed
What would you like to do?
Provisions an app gateway and a scale set
#!/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
@dstarr

This comment has been minimized.

Copy link
Owner Author

dstarr commented Jun 18, 2019

This code, when running in my Azure account, dies during step "#######".

It emits the following error:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.