Commands › Exchange Online

Test-OAuthConnectivity

Exchange Online ExchangeOnlineManagement Test-*

Test OAuth authentication to partner applications for a user.

Quick start script

# Test-OAuthConnectivity — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Run and inspect
Test-OAuthConnectivity -Service <ModServiceType> -TargetUri <Uri> | Format-List

# 3. Export for evidence / drift tracking
Test-OAuthConnectivity | Export-Clixml .\OAuthConnectivity-$(Get-Date -Format yyyyMMdd).xml

Syntax

Test-OAuthConnectivity -Service <ModServiceType> -TargetUri <Uri>
 [-AppOnly]
 [-Confirm]
 [-Mailbox <MailboxIdParameter>]
 [-ReloadConfig]
 [-UseCachedToken]
 [-WhatIf]
 [<CommonParameters>]

Parameters (8)

ParameterTypeRequiredWhat it controls
-Service ModServiceType yes The Service parameter specifies the partner application. Valid values for this parameter are:
-TargetUri Uri yes The TargetUri parameter specifies the URL for the service you want to test OAuth connectivity with.
-AppOnly SwitchParameter The AppOnly switch specifies the cmdlet authenticates to the specified service as Exchange without any user context. You don't need to specify a value with this switch.
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-Mailbox MailboxIdParameter The Mailbox parameter specifies the mailbox for which you want to test OAuth connectivity to the specified partner application. You can use any value that uniquely identifies the mailbox. For example:
-ReloadConfig SwitchParameter The ReloadConfig switch reloads all the configuration settings from the Exchange configuration objects. You don't need to specify a value with this switch.
-UseCachedToken SwitchParameter The UseCachedToken switch specifies that OAuth tries to use an existing, cached authorization token. You don't need to specify a value with this switch.
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.