Created
November 7, 2018 11:20
-
-
Save GBSmulders/f5ce90e9a0846ac2fe3b80d0258e540e 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 | |
appName=appName | |
resourceGroup=recourcegroup | |
key=devKey | |
value=superDuperSecret | |
jsonString='{"name":"'"${key}"'","value":"'"$value"'"}' | |
userName=$(az webapp deployment list-publishing-profiles -n ${appName} -g ${resourceGroup} --query "[?publishMethod=='MSDeploy'].userName" --output tsv) | |
userPassword=$(az webapp deployment list-publishing-profiles -n ${appName} -g ${resourceGroup} --query "[?publishMethod=='MSDeploy'].userPWD" --output tsv) | |
bearerToken=$(curl -u ${userName}:${userPassword} -sb -X GET https://${appName}.scm.azurewebsites.net/api/functions/admin/token | sed 's/.\(.*\)/\1/' | sed 's/\(.*\)./\1/') | |
curl -sb -X PUT -H "Authorization: Bearer ${bearerToken}" -H "Content-Type: application/json" -d $jsonString https://${appName}.azurewebsites.net/admin/host/keys/${key} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment