forked from Azure-Samples/azure-cli-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-single-availability-zone.sh
More file actions
30 lines (26 loc) · 975 Bytes
/
create-single-availability-zone.sh
File metadata and controls
30 lines (26 loc) · 975 Bytes
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
#!/bin/bash
# Create a resource group
az group create --name myResourceGroup --location eastus2
# Create a scale set in Availability Zone 1
az vmss create \
--resource-group myResourceGroup \
--name myScaleSet \
--image UbuntuLTS \
--upgrade-policy-mode automatic \
--admin-username azureuser \
--generate-ssh-keys \
--zones 1
# Apply the Custom Script Extension that installs a basic Nginx webserver
az vmss extension set \
--publisher Microsoft.Azure.Extensions \
--version 2.0 \
--name CustomScript \
--resource-group myResourceGroup \
--vmss-name myScaleSet \
--settings '{"fileUris":["https://raw.githubusercontent.com/Azure-Samples/compute-automation-configurations/master/automate_nginx.sh"],"commandToExecute":"./automate_nginx.sh"}'
# Output the public IP address to access the site in a web browser
az network public-ip show \
--resource-group myResourceGroup \
--name myScaleSetLBPublicIP \
--query [ipAddress] \
--output tsv