Moving from the Exchange PowerShell v1 Module to the v2 Preview
Published May 31 2022 04:28 PM 15.8K Views

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.

Scenario 1: Connections to Exchange Online PowerShell

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

https://partner.outlook.cn/PowerShell

Office 365 Germany

https://outlook.office.de/powershell-liveid/

Microsoft 365 GCC High

https://outlook.office365.us/powershell-liveid/

Microsoft 365 DoD

https://webmail.apps.mil/powershell-liveid

Scenario 2: Connections to Security and Compliance Center PowerShell

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/

Scenario 3: Connections to Exchange Online Protection PowerShell

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

https://ps.protection.outlook.de/powershell-liveid/

For Exchange Server organizations with Exchange Enterprise CAL with Services licenses

https://outlook.office365.com/powershell-liveid/

We hope you find this useful.  Be sure to let us know and share your feedback in the comments section!

Exchange Online Manageability Team

2 Comments
Co-Authors
Version history
Last update:
‎Jul 07 2022 04:23 AM
Updated by: