Created
June 26, 2024 11:42
-
-
Save starkfell/f153a0176cb6a839e06ad696b494fef5 to your computer and use it in GitHub Desktop.
Retrieve the Access Token of the current Azure Account you are logged in as.
This file contains hidden or 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
# Modified version of https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#file-jwt-decode-sh that | |
# retrieves the Access Token of the current Azure Account you are logged in as. | |
# will not work in all cases, see https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#gistcomment-3439904 | |
function jwt-decode() { | |
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq | |
} | |
az account show | |
JWT=$(az account get-access-token --query accessToken --output tsv) | |
jwt-decode $JWT && echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment