Skip to content

Instantly share code, notes, and snippets.

@markscottwright
Last active August 10, 2021 15:12
Show Gist options
  • Save markscottwright/6b55d9b01d5769e9a7924dfaca40b4b5 to your computer and use it in GitHub Desktop.
Save markscottwright/6b55d9b01d5769e9a7924dfaca40b4b5 to your computer and use it in GitHub Desktop.
How to get an Azure Managed Identity token using curl
token=`curl -s 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fstorage.azure.com' -H Metadata:true | grep -o 'access.token[": ]\+[^"]\+' | sed s/access_token...//`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment