Created
November 19, 2023 02:32
-
-
Save AlLongley/a15bf7a6faaf363f0d7a77c097b5f981 to your computer and use it in GitHub Desktop.
PowerShell Microsoft Graph/ExchangeOnline/API FUN
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
# There's no simple built-in equivalent of the powershell Get-AzAccessToken to dump the active Auth/Bearer/token | |
# from the session initiated with Connect-ExchangeOnline | |
# This dumps all active sessions in current PoSH context | |
[Microsoft.Exchange.Management.ExoPowershellSnapin.ConnectionContextFactory]::GetAllConnectionContexts() | ConvertTo-JSON | |
[Microsoft.Exchange.Management.ExoPowershellSnapin.ConnectionContextFactory]::GetAllConnectionContexts() | select PowerShellTokenInfo | ConvertTo-JSON | |
[Microsoft.Exchange.Management.ExoPowershellSnapin.ConnectionContextFactory]::GetAllConnectionContexts() | Where-Object {-not [System.String]::IsNullOrEmpty($_.PowerShellCredentials)} | select PowerShellTokenInfo | ConvertTo-JSON |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment