Exchange 2016 Hybrid OAuth to Exchange Online EWS failing with 403 after HCW rerun

Shawn Alston 0 Reputation points
2026-07-17T16:32:00.8533333+00:00

We are working on completing an Exchange hybrid migration/decommission project and are blocked by an OAuth issue.

Environment:

  • Exchange Server 2016 CU23
  • Build 15.01.2507.061
  • Single on-prem Exchange server
  • Hybrid with Exchange Online
  • HCW was rerun successfully
  • Mail flow is working
  • Exchange services are healthy
  • MRSProxy is enabled

Main issue:

When running Test-OAuthConnectivity from the on-prem Exchange server to Exchange Online EWS, the token appears to build successfully, but Exchange Online returns 403 Forbidden.

Command:

Test-OAuthConnectivity -Service EWS `

-TargetUri https://outlook.office365.com/ews/exchange.asmx `

-Mailbox ******@domain.org `

-Verbose | fl *

Result:

System.Net.WebException: The remote server returned an error: (403) Forbidden.

What we have already checked:

  • Exchange 2016 CU23 is updated to build 15.01.2507.061
  • TLS 1.2 is enabled
  • Outbound connectivity to Exchange Online works
  • HCW completed successfully
  • AuthConfig has a valid Exchange Auth Certificate
  • PartnerApplication for Exchange Online is enabled
  • ACS and EvoSts AuthServers are enabled
  • IntraOrganizationConnector is enabled
  • OrganizationRelationship is enabled
  • MRSProxy is enabled
  • A previous firewall/NAT issue was fixed; MRSProxy is now reachable externally

Current status:

  • Mail flow is working
  • HCW completed
  • OAuth test still fails with 403
  • Migration endpoint reaches MRSProxy now, but we are still validating an Access Denied result there

Question:

What are the safest next steps to troubleshoot or repair Exchange 2016 hybrid OAuth when Test-OAuthConnectivity builds the token but Exchange Online rejects it with 403 Forbidden?

Should we be looking at the Exchange Auth Certificate, AuthConfig, PartnerApplication/AuthServer objects, or something on the Exchange Online side of the hybrid trust?

Any guidance would be appreciated.

Exchange | Hybrid management
Exchange | Hybrid management

The administration of a hybrid deployment that connects on-premises Exchange Server with Exchange Online, enabling seamless integration and centralized control.

0 comments No comments

1 answer

Sort by: Newest
  1. Anonymous
    2026-07-18T04:13:17.1066667+00:00

    Hi @Shawn Alston

    Thank you for providing the detailed information and troubleshooting steps you have already completed.

    Since the OAuth token is generated successfully but Exchange Online returns HTTP 403 Forbidden, the issue is likely occurring during the validation of the OAuth trust relationship rather than during token creation. Before rebuilding any hybrid components, I recommend validating the existing OAuth configuration.

    1.Verify the Exchange Auth Certificate

    On the Exchange 2016 server, confirm the active OAuth certificate:

    Get-AuthConfig | Format-List
    Get-ExchangeCertificate | Format-List Thumbprint,Subject,NotAfter,HasPrivateKey
    

    Confirm that:

    • CurrentCertificateThumbprint matches the OAuth certificate thumbprint.
    • The certificate is not expired.
    • The certificate has a private key.

    If the OAuth certificate was recently renewed, rotated, or replaced, verify that the published certificate information matches the current AuthConfig settings before considering republishing.

    2.Validate the PartnerApplication and AuthServer objects

    Check that the Exchange Online trust objects are enabled and contain the expected metadata:

    Get-PartnerApplication | Format-List Name,Enabled,ApplicationIdentifier
    Get-AuthServer | Format-Table Name,Enabled,Type,AuthMetadataUrl
    

    3.Verify the Exchange Online side of the hybrid trust

    From Exchange Online PowerShell, validate the hybrid relationship objects:

    Get-IntraOrganizationConnector | Format-List *
    Get-OrganizationRelationship | Format-List *
    

    Confirm that the objects are enabled and still reflect the current hybrid configuration.

    4.Perform additional OAuth validation and review HCW logs

    If possible, perform additional OAuth validation and review the Hybrid Configuration Wizard logs for OAuth-related warnings or errors. This can help determine whether the issue is isolated to a specific trust path or affects the hybrid OAuth relationship more broadly.

    5.Validate EWS/MRSProxy configuration separately

    Since the migration endpoint is now reaching MRSProxy but returning Access Denied, validate the EWS virtual directory configuration:

    Get-WebServicesVirtualDirectory | Format-List Identity,ExternalUrl,OAuthAuthentication,WindowsAuthentication
    

    and confirm that MRSProxy is enabled:

    Get-WebServicesVirtualDirectory | Format-List Identity,MRSProxyEnabled
    

    6.If mailbox migrations continue to fail with Access Denied, enable additional OAuth logging for MRS:

    New-SettingOverride -Name "MRS OAuthLogging Settings" 
    -Component "Mrs" 
    -Section "MRSProxyAuthLogging" 
    -Parameters ("Enabled=true") 
    -Reason "Enable MRS OAuth Logging"
    

    Restart the Microsoft Exchange Mailbox Replication service after applying the override:

    Restart-Service MSExchangeMailboxReplication
    

     I hope this helps.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".       

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.   

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.