Created
August 10, 2020 12:40
-
-
Save Blaapje/c53a87d2d199d021e7edd3b3c071fcaf to your computer and use it in GitHub Desktop.
Create static webpage on azure
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/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