Created
September 5, 2018 22:45
-
-
Save jim-minter/a108288a581c053cdf2e62f6998b6339 to your computer and use it in GitHub Desktop.
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/bash -e | |
usage() { | |
cat <<EOF >&2 | |
usage: | |
$0 get-config resourcegroup | |
EOF | |
exit 1 | |
} | |
case "$1" in | |
get-config) | |
if [[ "$#" -ne 2 ]]; then usage; fi | |
OSACONFIG=$(mktemp -d) | |
trap "rm -rf $OSACONFIG" EXIT | |
export AZURE_STORAGE_ACCOUNT=$(az storage account list -g $2 | jq '.[] | select(.tags.type == "config") | .name ' | tr -d '"') | |
export AZURE_STORAGE_KEY=$(az storage account keys list -n $AZURE_STORAGE_ACCOUNT -g $2 --query '[0].value' | tr -d '"') | |
az storage blob download --file $OSACONFIG/config -c config -n config --no-progress >/dev/null | |
cat $OSACONFIG/config | |
;; | |
*) | |
usage | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment