From 2b4da1d08d11a9f43a830dfdf4da736feaf2dffe Mon Sep 17 00:00:00 2001 From: Christian Fosli Date: Sun, 14 Aug 2022 19:28:10 +0200 Subject: [PATCH] feat: add script to create storage account for storing review photos Related-work: #6 --- scripts/az-create-storage-account.bash | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/az-create-storage-account.bash diff --git a/scripts/az-create-storage-account.bash b/scripts/az-create-storage-account.bash new file mode 100755 index 0000000..81dc30f --- /dev/null +++ b/scripts/az-create-storage-account.bash @@ -0,0 +1,23 @@ +#!/bin/bash +set -eo pipefail + +if [[ -z "$1" ]] || [[ "$1" == "--help" ]] +then + printf 'Usage: %s {env}\n\t{env}=dev|prod\nPrereq: Log in to azure CLI and choose the correct subscription\n' "$0" + exit 1 +fi + +env="$1" + +az storage account create -n "ststellerom${env}" -g "rg-stellerom-${env}" \ + -l norwayeast \ + --min-tls-version TLS1_2 + +if [[ "$env" == prod ]] +then + origin="www.stellerom.no" +else + origin="$env.stellerom.no" +fi + +az storage cors add --methods GET --origins "$origin" --services b --account-name "ststellerom${env}"