Skip to content

Authenticate with and call the Microsoft Graph

Author: Garry Trinder

Obtain a new access token for the Microsoft Graph and use it an HTTP request.

$token = m365 util accesstoken get --resource --new --output text
$me = Invoke-RestMethod -Uri -Headers @{"Authorization"="Bearer $token"}

# requires jq:

token=`m365 util accesstoken get --resource --new --output text`
me=`curl -H "Authorization: Bearer $token"`
echo $me | jq


  • Microsoft Graph
  • Access Token
  • HTTP