Skip to content

/errors/purview/enablesearchonlysession-required

Please close the current PowerShell session ... Connect-IPPSSession with the -EnableSearchOnlySession flag

The commands on this page have not been executed by our verification runner yet.updated
tool
Microsoft Purview (Security & Compliance PowerShell)
versions
ExchangeOnlineManagement 3.9.0+
os
windows, linux, macos

The full message is Please close the current PowerShell session and open a new session using Connect-IPPSSession with the -EnableSearchOnlySession flag. This requires using ExchangeOnlineManagement v3.9.0 or higher. Microsoft changed the eDiscovery cmdlets (*-ComplianceSearch and New-ComplianceSearchAction) in August 2025: they now work only in a Security & Compliance session opened with the -EnableSearchOnlySession switch, which exists in module 3.9.0 and later.

powershell
Update-Module ExchangeOnlineManagement      # if older than 3.9.0
# new PowerShell window
Connect-IPPSSession -UserPrincipalName admin@contoso.com -EnableSearchOnlySession
New-ComplianceSearch -Name "Case 1234" -ExchangeLocation anna@contoso.com

As the message says, adding the switch to an existing session is not enough: start a new PowerShell session, then connect with the switch.

Check the module version

powershell
Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name,Version

If several versions are installed, import the newest explicitly (Import-Module ExchangeOnlineManagement -RequiredVersion 3.10.1) before connecting.

App-only automations

Microsoft states that app-only (certificate) authentication for eDiscovery cmdlets is unsupported. For existing automations that keep using it, Microsoft asks for module 3.10.1 or later, the -EnableSearchOnlySession switch and the service principal and eDiscovery role configuration described in its Purview eDiscovery permissions article, and recommends moving those automations to the Microsoft Graph eDiscovery APIs.

Sources