Forum Discussion

Jeff Harlow's avatar
Jeff Harlow
Iron Contributor
Feb 05, 2019

Unable to connect to Exchange Online (Powershell) with MFA

Anyone see this error when attempting to connect to Exchange Online with MFA?

 


out-lineoutput : The method or operation is not implemented.
    + CategoryInfo          : NotSpecified: (:) [out-lineoutput], NotImplementedException
    + FullyQualifiedErrorId : System.NotImplementedException,Microsoft.PowerShell.Commands.OutLineOutputCommand
 

Installed the hybrid exchange module from Exchange Online as I have always done. Also installed other AzureAD and seeing the same error (i.e Get-MSOLuser) 

 

The only thing i believe is different this round was that I installed Powershell 5.1 (and even 6.1.2 thinking it might have been a bug).    Help 

 

11 Replies

  • stechsols's avatar
    stechsols
    Copper Contributor
    I have a question; why is it possible to view email addresses(Global Address list) from public computers when you login to Microsoft Azure GovCloud with RSA Key? (https://login.microsoftonline.com) . Even more concerning is accessing outlook server, sharepoint and skype. Can someone share any insight?
  • kabelo Phefo's avatar
    kabelo Phefo
    Copper Contributor

    I had the smililar issue and it turned out to be the old version of MSOnline and AzureAD please try use the below make sure to uninstall old AzureAD if you have one installed.

     

    AzureAD V2 module: https://www.powershellgallery.com/packages/AzureAD/2.0.0.131

    MSOnline module: https://www.powershellgallery.com/packages/MSOnline/1.1.166.0

     

     

    • Jeff Harlow's avatar
      Jeff Harlow
      Iron Contributor

      Sadly none of these have fixed the problem. I can confirm my scripts work with Visual Studio Code. Guess I have to get used to using this instead. Not a bad thing I suppose.  

      • EvanAlmighty's avatar
        EvanAlmighty
        Copper Contributor

        Jeff Harlow 

        I'm using something I found online similar to what VasilMichev  posted earlier. This allows me to establish a MFA enabled EXOPSession from within a script I run via the ISE:

        $CreateEXOPSSession = (Get-ChildItem -Path $env:userprofile -Filter CreateExoPSSession.ps1 -Recurse -ErrorAction SilentlyContinue -Force | Select -Last 1).DirectoryName
        . "$CreateEXOPSSession\CreateExoPSSession.ps1"
        
        Connect-EXOPSSession -userprincipalname 

         Hope that helps.

  • Matthew Roerig's avatar
    Matthew Roerig
    Copper Contributor

    Hi Jeff,

     

    Try importing the module manually. Run the following commands, delineated by the semicolon:

     

    $Modules = @(Get-ChildItem -Path "$($env:LOCALAPPDATA)\Apps\2.0" -Filter "Microsoft.Exchange.Management.ExoPowershellModule.manifest" -Recurse );

    $ModuleName = Join-path $Modules[0].Directory.FullName "Microsoft.Exchange.Management.ExoPowershellModule.dll";

    Import-Module -FullyQualifiedName $ModuleName -Force;

    $SessionMFEXO = New-ExoPSSession -ConnectionUri 'https://outlook.office365.com/PowerShell-LiveId' -AzureADAuthorizationEndpointUri 'https://login.windows.net/common';

    Import-PSSession $SessionMFEXO -AllowClobber;

     

     

    I've tested with PowerShell ISE Host version 5.1.17134.407, which does work.

  • Works fine here. Do note however that the MFA module does NOT support PowerShell Core yet, use the "old" version (the one built-in in Windows).

    • Jeff Harlow's avatar
      Jeff Harlow
      Iron Contributor

      How do I switch to the old version. I am using PS-ISE. Thanks,. 

      • VasilMichev's avatar
        VasilMichev
        MVP

        You shouldn't be using the ISE. When you install the ExO MFA module, it will place a shortcut on your desktop. Use that to launch it, then use the Connect-EXOPSSession cmdlet to connect.

Resources