Skip to content

Instantly share code, notes, and snippets.

@Calvindd2f
Created October 11, 2024 01:44
Show Gist options
  • Select an option

  • Save Calvindd2f/95b96dd5289ec08a06555f1af080d083 to your computer and use it in GitHub Desktop.

Select an option

Save Calvindd2f/95b96dd5289ec08a06555f1af080d083 to your computer and use it in GitHub Desktop.
Function ReturnDelegatedToken
{
$request=Invoke-MgGraphRequest -Method GET -Uri 'https://graph.microsoft.com/v1.0/me' -OutputType HttpResponseMessage
$B=$request.RequestMessage.Headers.Authorization.Scheme
$AT=$request.RequestMessage.Headers.Authorization.Parameter
return @{
Authorization = "$B $AT"
'User-Agent' = 'Mozilla/5.0, (Windows NT 10.0; Microsoft Windows 10.0.26100; en-NL), PowerShell/7.4.5, Invoke-MgGraphRequest'
'Accept-Encoding' = 'gzip'
SdkVersion = 'graph-powershell/2.20.0'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment