Created
May 6, 2025 19:45
-
-
Save lgp1985/6814281d1c5c974bb496dad748fb66cd to your computer and use it in GitHub Desktop.
Quickly pass token to an Azure Microsoft Graph call with PowerShell
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
$azToken = az account get-access-token --resource https://graph.microsoft.com | ConvertFrom-Json | |
Invoke-WebRequest -Headers @{Authorization="$($azToken.tokenType) $($azToken.accessToken)"} https://graph.microsoft.com/v1.0/users/me |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example URL obtained from https://learn.microsoft.com/en-us/graph/api/application-list?view=graph-rest-1.0&tabs=http