Skip to content

Instantly share code, notes, and snippets.

@sjwaight
Last active June 30, 2017 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjwaight/8a530aff0e5f3991484176825b49a563 to your computer and use it in GitHub Desktop.
Save sjwaight/8a530aff0e5f3991484176825b49a563 to your computer and use it in GitHub Desktop.
bash script that enables the phpMyAdmin Site Extension on an Azure Web App
#!/bin/sh
azuresub=$1
demoresourcegroup=$2
webappname=$3
deployuser=$4
deploypass=$5
# CAUTION! RESTS CREDS for *all* Web Apps
# az webapp deployment user set --user-name $deployuser --password $deploypass
# read the phpmyadmin extension configuration (required to create it)
wget --user $deployuser --password $deploypass https://${webappname}.scm.azurewebsites.net/api/siteextensions/phpmyadmin --output-document phpmyadmin.ext.json
# enable the phpmyadmin extension - sends the extension definition in the body
curl -u $deployuser:$deploypass -i -X PUT -H "Content-Type:application/json" https://${webappname}.scm.azurewebsites.net/api/siteextensions/phpmyadmin -d @phpmyadmin.ext.json
# restart our Web App to ensure the route is registered to phpMyAdmin
az webapp restart --name ${webappname} --resource-group $demoresourcegroup
echo
echo "Open a web browser at https://"$webappname".scm.azurewebsites.net/phpMyAdmin/ to access the MySQL web manager."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment