Share via

Login error with multi-factor authentication

Anonymous
2018-03-12T21:06:23+00:00

Hi

I downloaded in "Exchange admin center" -> "hybrid" The Exchange Online PowerShell Module supports multi-factor authentication.

Then I tried to connect with the command:

Connect-EXOPSSession -UserPrincipalName myDomain.com

After executing this command the login window popped up. I entered my username and password. And I Approved the login on my phone with the "Authenticator App".

But then I get this error:

PS C:\Users\Enrico> Connect-EXOPSSession -UserPrincipalName myDomain.com

New-ExoPSSession : User '******@myDomain.com' returned by service does not match user 'myDomain.com' in the

request

At C:\Users\Enrico\AppData\Local\Apps\2.0\PJTM422K.3YX\CPDGZBC7.ZRE\micr..tion_a8eee8aa09b0c4a7_0010.0000_46a3c36b19dd5

128\CreateExoPSSession.ps1:187 char:22

  • ... PSSession = New-ExoPSSession -UserPrincipalName $UserPrincipalName -C ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [New-ExoPSSession], AdalUserMismatchException

    + FullyQualifiedErrorId : Microsoft.IdentityModel.Clients.ActiveDirectory.AdalUserMismatchException,Microsoft.Exch

   ange.Management.ExoPowershellSnapin.NewExoPSSession

Login to the website "Office Admin center" works fine without problems.

Thanks

-Enrico

Microsoft 365 and Office | Subscription, account, billing | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2018-03-16T01:29:26+00:00

    Hi Enrico,

    Thanks for your feedback. Based on the error message you provided, please help to use ***Connect-IPPSSession -UserPrincipalName ***@contoso.comto see if there exsit the error message.

    Meanwhile, please help to check if your UserPrincipalName (UPN) is name which was shown in the screenshot you provided, you can use the Microsoft Azure Active Directory Module for Windows PowerShell to check it (please connect to this shell by using another admin account): https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-office-365-powershell and https://docs.microsoft.com/en-us/office365/enterprise/powershell/view-user-accounts-with-office-365-powershell

    Please also send us a screenshot (result of Get-MsolUser) via Private Message, we will help to check it.

    Thanks,

    Ricahrd

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-03-15T16:07:31+00:00

    Hi

    I have no open Session. I tried a NOT MFA account and it works.

    My problem is that with my account I get this error:

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2018-03-14T02:53:54+00:00

    Hi Enrico,

    Generally, if we want to connect Security & Compliance Center services, we can use following command:

    If there is any error message, please send us a complete screenshotabout it.

    Meanwhile, please follow this article to connect the Secruity & Compliance Center: https://technet.microsoft.com/en-us/library/mt811266(v=exchg.160).aspx. Note: please note the command connect to Secruity & Compliance Center is: ***Connect-IPPSSession -UserPrincipalName ***@contoso.comnot the Connect-EXOPSSession -UserPrincipalName myDomain.com

    Thanks,

    Richard

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2018-03-13T18:56:58+00:00

    hi

    Yes the problem is with powershell and MFA. As you can read in my first message:

    I installed: Exchange Online Remote PowerShell Module

    I used: PS C:\Users\Enrico> Connect-EXOPSSession -UserPrincipalName myDomain.com

    Admin account without MFA works fine.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2018-03-13T02:26:28+00:00

    Hi Enrico,

    Based on your description, may I know if you mean you have an error when you connect to connect to Office 365 services with MFA and PowerShell? If yes, when you use the PowerShell to connect to Office 365 services, you are prompted with a dialog box to collect the account user name and password and then an additional dialog box for MFA information.

    Meanwhile, if you want to use multi-factor authentication (MFA) to connect to Exchange Online PowerShell, you can't use the instructions at *Connect to Exchange Online PowerShell*to use remote PowerShell to connect to Exchange Online. MFA requires you to install the Exchange Online Remote PowerShell Module, and use the Connect-EXOPSSession cmdlet to connect. You can see: https://technet.microsoft.com/en-us/library/mt775114(v=exchg.160).aspx (please check every steps from above article)

    Meanwhile, about you receive the error, there are some requirements, please check:

    1. To help prevent denial-of-service (DoS) attacks, you're limited to three open remote PowerShell connections to your Exchange Online organization.
    2. The account you use to connect to Exchange Online must be enabled for remote PowerShell. For more information, see Enable or disable access to Exchange Online PowerShell.
    3. TCP port 80 traffic needs to be open between your local computer and Office 365. It's probably open, but it’s something to consider if your organization has a restrictive Internet access policy.

    Thanks,

    Richard

    Was this answer helpful?

    0 comments No comments