Skip to content

Instantly share code, notes, and snippets.

@gambtho
Last active October 1, 2019 16:30
Show Gist options
  • Save gambtho/3ea8ccc8fe1ddcf1a7d4fa31a6388e1e to your computer and use it in GitHub Desktop.
Save gambtho/3ea8ccc8fe1ddcf1a7d4fa31a6388e1e to your computer and use it in GitHub Desktop.
#!/bin/bash
# install az cli
# rpm --import https://packages.microsoft.com/keys/microsoft.asc
# sh -c 'echo -e "[azure-cli]
# name=Azure CLI
# baseurl=https://packages.microsoft.com/yumrepos/azure-cli
# enabled=1
# gpgcheck=1
# gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
# yum install azure-cli -y
# install jq
wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
chmod +x ./jq
mv jq /usr/bin
token=`curl 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net' -H Metadata:true | jq -r .access_token`
echo $kv_url
echo $user
ls -l /home/$user
curl $kv_url/?api-version=2016-10-01 -H "Authorization: Bearer $token" | jq -r .value > /home/$user/.ssh/id_rsa
chmod 0700 /home/$user/.ssh/id_rsa
chown $user:$user /home/$user/.ssh/id_rsa
# install az copy
# install the package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment