Since our recent post explaining the different versions of Exchange Online PowerShell modules, we have been asked: What’s the best way to move from using Exchange PowerShell v1 module with Basic auth to using the v2 Preview module with Modern auth?
First, a bit of news on the subject: with the Exchange Online PowerShell module 2.0.6 Preview 6 version module, all cmdlets can be run as REST-backed cmdlets. This means that all Exchange Online cmdlets can be used in the Preview 6 module without WinRM Basic auth on the client machine.
As a reminder: the Exchange Online PowerShell v1 module with Basic auth will stop working starting October 1, 2022 when Basic authentication is turned off for connections to Exchange Online.
To switch from the v1 module with Basic auth to the v2 preview with Modern auth, you’ll need to install the v2 Preview 6 module by following these instructions. Then, configure your connections as described below. If you need help adding Modern auth to your scripts, please see App-only authentication for unattended scripts in the EXO V2 module.
Your existing PowerShell module connection is similar to the following:
$Session = $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Using the v2 module (with or without MFA), you can connect using:
Connect-ExchangeOnline -ConnectionUri https://outlook.office365.com/powershell-liveid/ -UserPrincipalName sally@contoso.com
You might need to use a different URI depending on your service endpoint:
Service endpoint |
URI to use |
Office 365 operated by 21Vianet |
|
Office 365 Germany |
|
Microsoft 365 GCC High |
|
Microsoft 365 DoD |
Your existing PowerShell connection is similar to the following:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Using the Exchange v2 module, you can connect using:
Connect-IPPSSession -Credential (Get-Credential) -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/
Because this scenario still uses RPS cmdlets, it still requires client machine basic auth on WinRM.
You might need to use a different URI depending on your service endpoint:
Service endpoint |
URI to use |
Microsoft 365 GCC High |
https://ps.compliance.protection.office365.us/powershell-liveid/ |
Microsoft 365 DoD |
https://l5.ps.compliance.protection.office365.us/powershell-liveid/ |
Your existing PowerShell connection is similar to the following:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Using the Exchange v2 module, you can connect using:
Connect-IPPSSession -Credential (Get-Credential) -ConnectionUri https://ps.protection.outlook.com/powershell-liveid/
Because this scenario still uses RPS cmdlets, it still requires client machine basic auth on WinRM.
You might need to use a different URI depending on your service endpoint:
Service endpoint |
URI to use |
Office 365 Germany |
|
For Exchange Server organizations with Exchange Enterprise CAL with Services licenses |
We hope you find this useful. Be sure to let us know and share your feedback in the comments section!
Exchange Online Manageability Team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.