Skip to content

Instantly share code, notes, and snippets.

@asears
Created August 30, 2018 01:30
Show Gist options
  • Select an option

  • Save asears/b10e4ee07b9a3f54ab62acef20c5efbf to your computer and use it in GitHub Desktop.

Select an option

Save asears/b10e4ee07b9a3f54ab62acef20c5efbf to your computer and use it in GitHub Desktop.
Get Azure Cloud Shell Access Token
#!/bin/sh
response=$(curl http://localhost:50342/oauth2/token --data "resource=https://management.azure.com/" -H Metadata:true -s)
access_token=$(echo $response | python -c 'import sys, json; print (json.load(sys.stdin)["access_token"])')
echo The MSI access token is $access_token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment