[ad_1]
Since posting our recent 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:
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/
You might need to use a different URI depending on your service endpoint:
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/
You might need to use a different URI depending on your service endpoint:
We hope you find this useful. Be sure to let us know and share your feedback in the comments section!
Source link