Connect-ExchangeOnline (OAth fun)

CWT 391 Reputation points
2020-12-18T23:59:48.62+00:00

Good evening,

Been going round and round with with this and must be missing something. Seen and read plenty of articles, but the fix is not yet clear to me. I'm hoping for a new nugget of information that might help get me over the hump (more clarity). When I run Connect-ExchangeOnline, it takes me through the pop-ups (credentials) as it should along with the MFA prompt via device. It then presents me with the following error. Any advice or tips from experience would be very appreciated. Can access the O365 portal without issue (MFA etc) and the ExchangeOnlineManagement module is definitely installed.

Command:
Connect-ExchangeOnline

Error:
New-ExoPSSession : Create Powershell Session is failed using OAuth

Thanks much,

CWT

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,169 questions
0 comments No comments
{count} votes

Accepted answer
  1. KyleXu-MSFT 26,206 Reputation points
    2020-12-22T01:31:32.617+00:00

    @CWT

    Check and modify those three steps:
    50222-qa-kyle-09-28-25.png

    Enable basic authentication on your computer.


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.

    0 comments No comments

5 additional answers

Sort by: Most helpful
  1. Vasil Michev 95,081 Reputation points MVP
    2020-12-19T08:41:50.9+00:00

    If will help if you share the exact cmdlet you are using to connect. New-ExoPSSession is an internal cmdlet, you should not be using that. Use Connect-ExchangeOnline instead.

    0 comments No comments

  2. Boubacar Diallo 456 Reputation points
    2020-12-20T05:45:48.637+00:00

    I'm not sure how to get the Microsoft Exchange Online PowerShell Module. but you can download it directly by going to your EXO admin portal > hybrid > then click on "configure" below where it says "The Exchange Online PowerShell Module supports multi-factor authentication"

    Then it will download and you will be able to install it. But make sure you use IE browser or else it will fail with other browsers.

    Finally, you will then be able to connect to EXO-PowerShell using below cmdlets.

    Connect-EXOPSSession -UserPrincipalName admin@mathieu.company .com

    if you're already connected to your exo admin portal from the browser, it will automatically sign you in without prompting you to the MFA page. Hope that help.

    0 comments No comments

  3. KyleXu-MSFT 26,206 Reputation points
    2020-12-21T03:33:10.947+00:00

    @CWT

    Make sure the way that you used is correct:

    Way 1:

    1. Download "Exchange Online PowerShell Module" from Exchange Online Admin center:
      49810-1.png
    2. Create connection request: Connect-EXOPSSession [-UserPrincipalName -ConnectionUri <ConnectionUri> -AzureADAuthorizationEndPointUri <AzureADUri> -DelegatedOrganization <String>]

    49754-2.png

    Way 2(V2 module):

    Run PowerShell with administrator privileges to install EXO V2 module

    Install-Module PowershellGet -Force  
    Set-ExecutionPolicy RemoteSigned  
    

    Close PowerShell Windows, then open a new one, then run command below:

    Install-Module -Name ExchangeOnlineManagement  
    

    Connect to Exchange online with MFA(Make sure your account is enabled MFA, otherwise you will get an error)
    49777-3.png
    49755-4.png

    V1 module - Connect to Exchange Online PowerShell using MFA
    Exchange Online PowerShell V2 module


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.

    0 comments No comments

  4. CWT 391 Reputation points
    2020-12-21T15:12:16.473+00:00

    Thank you for the replies and instructions. I could have better explained my issue, so I have updated the original thread to essentially reflect the following problem I have yet to resolve.

    Command:
    Connect-ExchangeOnline

    Error:
    New-ExoPSSession : Create Powershell Session is failed using OAuth

    Thanks,

    CWT