Getting a 403 Forbidden Error with New-ComplianceSearchAction

0
18
Asked By CuriousCoder87 On

I've hit a roadblock trying to automate email purging with my PowerShell script. Everything was running smoothly until now. I can still create a New-ComplianceSearch without any problems, but as soon as I attempt to use New-ComplianceSearchAction for previewing the search, I get this frustrating error: "Unable to execute the task. Reason: The remote server returned an error: (403) Forbidden." I even tried running `New-ComplianceSearchAction -SearchName $SomeSearch -Preview` on an existing search, and I keep getting the same 403 error. We've been using this script without issues for a while now. The only change I made recently was adding the -EnableSearchOnlySession flag to Connect-IPPSSession after Microsoft changed the permission settings last year. Does anyone know if there have been any recent role or permission updates, particularly related to GCC? Also, an edit I made on 3/4/2026 indicates that it appears Microsoft has disabled the -preview option for Exchange Online environments, making New-ComplianceSearchAction -preview return a 403 forbidden error. So now we may have to rely on the portal GUI for email validation before purging, which slows everything down.

2 Answers

Answered By PowerShellPro_2026 On

You're right about the preview parameter; it seems that Microsoft recently limited its functionality strictly to on-prem Exchange environments. That change appears to have taken place in the last few weeks, so it’s definitely worth looking into. The official docs recommend relying on the GUI for generating samples now.

Answered By TechNoWizard On

I’m not familiar with GCC specifically, but you might want to check if you’ve got the right PIM role activated for compliance searches. It's crucial for these kinds of tasks since every permission can impact the functionality. Maybe that could be causing the 403 error you're experiencing.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.