The message trace report displays information about each incoming and outgoing mail sent over the…
Connect to Security and Compliance PowerShell with Connect-IPPSSession
To connect to Microsoft Defender and Microsoft Purview compliance portal with PowerShell, you need to use the Connect-IPPSSession cmdlet in Exchange Online. In this article, you will learn how to connect to the Security and Compliance center with the Connect-IPPSSession PowerShell cmdlet.
Table of contents
How to connect to Security & Compliance PowerShell
Go through the below steps that are required to run the Connect-IPPSSession PowerShell cmdlet.
1. Install Exchange Online Management module
Before you start, you need to Install Exchange Online PowerShell module.
You can install Exchange Online Management modules with:
- PowerShellGet
- PSResourceGet
Method 1. Use PowerShellGet
Run the below PowerShell command to install the Exchange Online Management module.
Install-Module -Name ExchangeOnlineManagement -Force
Method 2. Use Microsoft PowerShell PSResourceGet
Run the Install-PSResource cmdlet to install the Exchange Online Management module.
Install-PSResource -Name ExchangeOnlineManagement -Force
2. Connect to Exchange Online PowerShell
To run the PowerShell commands, you must Connect to Exchange Online PowerShell.
Start Windows PowerShell as administrator and run the Connect-ExchangeOnline cmdlet.
Connect-ExchangeOnline
Sign in with your admin credentials with or without MFA enabled.
The PowerShell output shows the below after you sign in successfully.
This V3 EXO PowerShell module contains new REST API backed Exchange Online cmdlets which doesn't require WinRM for Client-Server communication. You can now run these cmdlets after turning off WinRM Basic Auth in your client machine thus making it more secure.
Unlike the EXO* prefixed cmdlets, the cmdlets in this module support full functional parity with the RPS (V1) cmdlets.
V3 cmdlets in the downloaded module are resilient to transient failures, handling retries and throttling errors inherently.
REST backed EOP and SCC cmdlets are also available in the V3 module. Similar to EXO, the cmdlets can be run without WinRM basic auth enabled.
For more information check https://aka.ms/exov3-module
3. Connect to Security & Compliance PowerShell
Then you need to connect again and run the Connect-IPPSSession PowerShell cmdlet.
Connect-IPPSSession
Sign in with your admin credentials with or without MFA enabled.
The PowerShell output shows the below result.
We have made updates to move the SCC admin experience to REST-based APIs. In doing so, we will be deprecating the legacy Remote PowerShell (RPS) protocol starting July 15, 2023.
Benefits of REST-based cmdlets: improved security, WinRM no longer required for client-server communication, improved error handling.
The REST API has the same cmdlets available and feature parity with RPS(V1) cmdlets, so existing scripts and processes don't need to be updated. Simply using the new module will ensure REST is used rather than RPS.
For more information, go to https://aka.ms/exov3-module
Now, you are connected to the Security and Compliance PowerShell.
Note: If some PowerShell commands still don’t work, it means you don’t have the required permissions. You can check the permissions and roles in the Microsoft Defender portal or the Microsoft Purview compliance portal.
Connect-IPPSSession cmdlet error
To connect to the Security and Compliance center with Connect-IPPSSession using REST API, you need the version EXO 3.2.0 and later.
If you don’t have Exchange Online Management module 3.2.0 or later, you will get the below warning when running the Connect-IPPSSession cmdlet.
WARNING: Your connection has been redirected to the following URI: “https://eur06b.ps.compliance.protection.outlook.com/Powershell-LiveId?BasicAuthToOAuthConversion=true;PSVersion=7.4.1”
When you run the below cmdlet, you will get an error.
New-ComplianceSearch -Name "Test Mailbox" -ExchangeLocation "Amanda.Hansen@m365info.com"
New-ComplianceSearch: The term ‘New-ComplianceSearch’ is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
How to fix Connect-IPPSSession cmdlet error
To fix the Connect-IPPSSession error in PowerShell, follow the below steps.
Check Exchange Online Management module version
There are two methods to check which EXO version you installed, depending on how you installed Exchange Online Management.
Method 1: Use Get-module
To check if you have the latest EXO module, run the Get-Module PowerShell cmdlet.
Get-Module -Name ExchangeOnlineManagement | Format-Table -Property Name, Version, ModuleType
The PowerShell output shows the version of the ExchangeOnlineManagement module.
Name Version ModuleType
---- ------- ----------
ExchangeOnlineManagement 3.4.0 Script
Method 2: Use Get-InstalledPSResource
To check if you have the latest EXO module, run the Get-InstalledPSResource PowerShell cmdlet.
Get-InstalledPSResource -Scope AllUsers
It shows a list of the ExchangeOnlineManagement and other modules you have installed.
Name Version Prerelease Repository Description
---- ------- ---------- ---------- -----------
ExchangeOnlineManagement 3.4.0 PSGallery This is a General Availability (GA) release of the Exchange Online Powershell V3 module.
Microsoft.Graph 2.12.0 PSGallery Microsoft Graph PowerShell module
Update Exchange Online Management module
If you already installed the Exchange Online module, you only need to update it. Always update the latest Exchange Online Management module to run the Connect-IPPSSession cmdlet.
Note: If the update does not work, remove the Exchange Online Management module and exit all PowerShell sessions. Next, start PowerShell and install the Exchange Online PowerShell module.
There are two methods to update the Exchange Online Management module, depending on how you installed it.
Method 1: Use PowerShellGet
To update the Exchange Online module to the latest version run the below PowerShell command.
Update-Module -Name ExchangeOnlineManagement -Force
Method 2: Use Microsoft PowerShell PSResource
Run the below PowerShell command to update to the latest version of the Exchange Online module.
Install-PSResource ExchangeOnlineManagement -Reinstall -Scope AllUsers -TrustRepository
That’s it!
Read more: Install Microsoft Graph PowerShell module»
Conclusion
You learned how to use the Connect-IPPSSession cmdlet in Exchange Online PowerShell. You must install and update the latest Exchange Online Management module version in PowerShell. Otherwise, you will get an error when you run the Connect-IPPSSession cmdlet.
Did you enjoy this article? You may also like Connect to Microsoft Graph PowerShell. Don’t forget to follow us and share this article.
This Post Has 0 Comments