Changing PowerShell Scripts to Modern Authentication

Chris Kirschnick 26 Reputation points
2022-09-05T10:11:18.057+00:00

Hi All,

Quite a newbie to PowerShell, so would appreciate some assistance with an existing script that I've been asked to changed to Modern Authentication.

I can see the line that I believe needs to be amended as the following:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Credential -Authentication Basic -AllowRedirection  

I've looked up some sites and pages (including the ones offered as I type this message). But as someone quite new to PowerShell, I don't know if they apply as the commands are somewhat different.

Happy to elaborate further, but please bare in mind my newness to the system. Thanks.

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,516 questions
{count} votes

Accepted answer
  1. Aholic Liang-MSFT 13,856 Reputation points Microsoft Vendor
    2022-09-06T08:37:12.183+00:00

    Hi ,
    Do you mean you need to connect to Exchange Online PowerShell with modern authentication?
    If so, you could refer to this link to run ”Connect-ExchangeOnline” command to connect .
    238105-2022-9-6-1.png

    In addition ,please make sure Windows PowerShell has EXO V2 module installed .
    About the Exchange Online PowerShell V2 module | Microsoft Learn


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Andy David - MVP 147.9K Reputation points MVP
    2022-09-06T17:00:05.037+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.