Skip to content

Instantly share code, notes, and snippets.

@KelvinTegelaar
Last active August 4, 2020 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KelvinTegelaar/648208521f1b8489552c373a4a867304 to your computer and use it in GitHub Desktop.
Save KelvinTegelaar/648208521f1b8489552c373a4a867304 to your computer and use it in GitHub Desktop.
#Run first time
$Exchangetoken = New-PartnerAccessToken -ApplicationId 'a0c73c16-a7e3-4564-9a95-2bdf47383716' -Scopes 'https://outlook.office365.com/.default' -Tenant $TenantID -UseDeviceAuthentication
write-host "Exchange Token: $($ExchangeToken.RefreshToken)"
#Run each following time
$ExchangeRefreshToken = 'ExchangeRefreshToken'
$UPN = "YourUPNHere@upn.com
$token = New-PartnerAccessToken -ApplicationId 'a0c73c16-a7e3-4564-9a95-2bdf47383716'-RefreshToken $ExchangeRefreshToken -Scopes 'https://outlook.office365.com/.default'
$tokenValue = "Bearer $($token.AccessToken)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment