Skip to content

Instantly share code, notes, and snippets.

@anthonychu
Created August 17, 2018 02:08
Show Gist options
  • Save anthonychu/7942ee2f79c82ef2d6a58e62f5469ab2 to your computer and use it in GitHub Desktop.
Save anthonychu/7942ee2f79c82ef2d6a58e62f5469ab2 to your computer and use it in GitHub Desktop.
#!/bin/bash
APPS=$(az functionapp list --query "[].{group: resourceGroup, name: name}" --output tsv)
IFS=$'\n'
for APP in $APPS
do
GROUP=$(echo $APP | cut -f 1)
NAME=$(echo $APP | cut -f 2)
VERSION=$(az functionapp config appsettings list -g $GROUP -n $NAME --query "[?name == 'FUNCTIONS_EXTENSION_VERSION'].value" --output tsv)
if [ "$VERSION" = "~2" ] || [ "$VERSION" = "~beta" ] || [ "$VERSION" = "beta" ]; then
echo "Function app $NAME with version $VERSION in group $GROUP is being updated."
$(az functionapp config appsettings set -n $NAME -g $GROUP --settings FUNCTIONS_EXTENSION_VERSION=2.0.11961-alpha)
echo "Restarting function app $NAME in group $GROUP."
$(az functionapp restart -n $NAME -g $GROUP)
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment