Last active
February 21, 2023 15:46
-
-
Save caseywatson/fe3cb797ae2b022d20fd44f8d6b99e7f to your computer and use it in GitHub Desktop.
Gets functionapp settings as an environment variable JSON object
This file contains hidden or 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 | |
| app_name=$1 | |
| resource_group=$2 | |
| settings=$(az functionapp config appsettings list \ | |
| --resource-group "$resource_group" \ | |
| --name "$app_name") | |
| if [[ $? == 0 ]]; then # az command succeeded | |
| printf "{ " | |
| echo $settings | jq -rc '.[]' | while read setting; do | |
| name=$(echo "$setting" | jq -r ".name") | |
| value=$(echo "$setting" | jq -r ".value") | |
| [[ -z $setting_written ]] || printf ", " | |
| printf "\"$name\": \"$value\"" | |
| setting_written=1 | |
| done | |
| printf " }\n" | |
| else | |
| echo "Unable to get app settings." | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment