Skip to content

Instantly share code, notes, and snippets.

@Blaapje
Created August 10, 2020 12:40
Show Gist options
  • Save Blaapje/c53a87d2d199d021e7edd3b3c071fcaf to your computer and use it in GitHub Desktop.
Save Blaapje/c53a87d2d199d021e7edd3b3c071fcaf to your computer and use it in GitHub Desktop.
Create static webpage on azure
#!/bin/sh
# Rerun this script as often as you want, its non-descructive.
if [ $# -eq 0 ]
then
echo "No resource group entered! Bye."
exit
fi
RG=$1
DISK=$2
if [ -z "$2" ]
then
echo "No diskname entered! Using default: disk$1"
DISK="disk""${RG//-}"
fi
# create resource group with tags
az group create --location westeurope --resource-group "$RG"
# create disk
az storage account create -l westeurope --name "$DISK" -g "$RG" --sku Standard_LRS
# set static website for disk
az storage blob service-properties update --404-document error.html --account-name "$DISK" --index-document index.html --static-website true
# sync files to storage disk (experimental)
az storage blob sync -c '$web' -s '.' --account-name "$DISK"
# open website just created (takes about 10s to sync, if you previously created error.html and index.html)
open $(az storage account show -n "$DISK" -g "$RG" --query primaryEndpoints.web -o tsv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment