Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Service to coordinate with Azure API and idempotently upload certificates
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
if [[ `azure service cert list | grep -c $service` -eq 0 ]]; then
openssl req -x509 \
-key $service-deployer.key \
-nodes \
-days 1365 -newkey rsa:2048 \
-out /tmp/$service-deployer.pem \
-subj ‘/ Inc./C=US’
openssl x509 \
-outform der \
-in /tmp/$service-deployer.pem \
-out /tmp/$service-deployer.pfx
azure service cert create $service /tmp/$service-deployer.pfx
azure service cert list | \
grep $service | \
awk '{print $3}' | \
tr -d '\n' > $output
rm -f /tmp/$service-deployer.{pem,pfx}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment