Skip to content

Instantly share code, notes, and snippets.

@atrauzzi
Last active July 9, 2020 08:06
Show Gist options
  • Save atrauzzi/187e38127634bb97a77cc71dcc1ef1b0 to your computer and use it in GitHub Desktop.
Save atrauzzi/187e38127634bb97a77cc71dcc1ef1b0 to your computer and use it in GitHub Desktop.
πŸ–‹ Azure App Service deployment using bash and CURL
#!/bin/bash
NAME="some-convention-driven-name-usually-a-resource-group"
APP="your-app-name-ideally-another-convention"
DEPLOYMENT_PASSWORD=`az appservice web deployment list-site-credentials \
--resource-group ${NAME} \
--name ${APP} \
--query publishingPassword \
--output tsv`
DEPLOYMENT_USERNAME=`az appservice web deployment list-site-credentials \
--resource-group ${NAME} \
--name ${APP} \
--query publishingUserName \
--output tsv`
DEPLOYMENT_HOST=`az appservice web deployment list-site-credentials \
--resource-group ${NAME} \
--name ${APP} \
--query name \
--output tsv`
PAIR="${DEPLOYMENT_USERNAME}:${DEPLOYMENT_PASSWORD}"
PAIR=$(echo $PAIR|tr -d '\n')
AUTHORIZATION_TOKEN=`echo -ne "$PAIR" | base64 -w 0`
AUTHORIZATION_HEADER="Authorization: Basic ${AUTHORIZATION_TOKEN}"
zip -r -v apps.zip apps/
curl -v -X PUT https://${DEPLOYMENT_HOST}.scm.azurewebsites.net/api/zip/site/wwwroot --header "${AUTHORIZATION_HEADER}" --upload-file apps.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment