Hybrid Exchange Public Folder Access

Matt Pollock 241 Reputation points


I am in the process of working through a test plan after recently setting up hybrid Exchange with O365.

I have been trying to follow the steps outlined in this MS article, with a view to testing O365 user access to on premise public folders.


I've not managed to get very far in my lab however, as I am met with an "Access denied" error when attempting to run the following command, as part of the process:

.\Sync-ModernMailPublicFolders.ps1 -Credential (Get-Credential) -CsvSummaryFile:sync_summary.csv

The credentials I am inputting are my global admin creds for O365.
I am able to connect to ExchangeOnline via Powershell with the same creds so I cannot see that there would be a permissions issue at this point:

Error returned from attempting to run the script:

Successful connection ExchangeOnline using the same creds

I don't really know where to begin with troubleshooting this one.
Any ideas would be greatly appreciated.



Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,059 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,227 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Andy David - MVP 138.6K Reputation points MVP

    Is that account protected by MFA? If so, temporarily remove that MFA requirement or use another account that isnt using MFA and try that.

    2 people found this answer helpful.

  2. KyleXu-MSFT 26,201 Reputation points

    @Matt Pollock

    From the script, we can know it connect to Exchange online in the way of basic auth:


    So, try to connect to Exchange online in this way first. If you cannot connect to Exchange online with basic auth, double check about the "What do you need to know before you begin" part in above article. Make sure configuration is correct.

    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.

  3. Matt Pollock 241 Reputation points

    The reason the scripts do not work is because Microsoft have disabled basic authentication in many if not all customer tenants.
    The PF sync scripts rely on basic authentication to work.

    This is discussed in this thread


    One of comments mentions a modified script - Sync-ModernMailPublicFoldersV2.txt - which can be used as a workaround to the original scripts, which Microsoft have yet to fix.

    I have run the modified script and successfully synced the on prem PF's with O365.

    0 comments No comments