Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

MFA #40

Open
alastaircupples opened this issue Sep 24, 2018 · 8 comments
Open

MFA #40

alastaircupples opened this issue Sep 24, 2018 · 8 comments

Comments

@alastaircupples
Copy link

having issues running this with MFA enabled

@Eu2
Copy link

Eu2 commented Dec 7, 2018

Same

@TechsUK
Copy link

TechsUK commented Jan 10, 2019

I think app password makes it work , but this could do with being updated for MFA.

@drogfild
Copy link

This really should be updated to support MFA

@PsychoData
Copy link

PsychoData commented Jan 30, 2019

I have been trying to look at rebuilding the modules to support MFA, unfortunately the best way to make MFA Work right now is to use the Exchange Online Hyrbid module.

In a browser supporting ClickOnce Applications, you can visit the MS shortlink http://aka.ms/exopspreview to install it . (It isn't still in preview, but I can't get someone at MS to make me a version that doesn't have preview in the URL)
Or, if you don't like following redirected shortlinks from random dudes on GitHub, head to https://outlook.office365.com/ecp -> Hybrid on bottom Left -> Configure Exchange Online Powershell Module and install it that way

Then, once you have that ClickOnce Application installed, basically anytime it says

$ExoSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $userCredential -Authentication Basic -AllowRedirection
Import-PSSession $ExoSession

Replace that with opening the Microsoft Exchange Online Powershell Module from your start menu.

I have this, as a in-progress method to load the module into any Powershell session, once that module from the link above is installed, though there are some commands that I haven't finished determining the purpose of or how to best replicate yet, so your-mileage-may-vary (Mostly related to reconnection or sessions, it looks like )

function Start-ExoPSSessionCmdlets ( $UserPrincipalName){
    Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|?{$_ -notmatch "_none_"}| sort LastWriteTime -Descending | select -First 1)

    $EXOSession = New-ExoPSSession -UserPrincipalName ("$UserPrincipalName")
    Import-PSSession $EXOSession -DisableNameChecking -AllowClobber 
}
Start-ExoPSSessionCmdlets

@PsychoData
Copy link

Speaking of rebuilding it to support MFA -

Would it be an acceptable solution to try to connect through the normal way ($ExoSession = New-PSSession ....; Import-PSSession $ExoSession ) and if that fails then try to load the Powershell Module
I listed above?

Or, we could look to see if the Exo Powershell Module is already installed, and use that if it is, and if not, try the $ExoSession = New-PSSession ....; Import-PSSession $ExoSession way, and suggest to install the module if it needs to?

@jasc76
Copy link

jasc76 commented Mar 1, 2019

please look into this... MFA is crucial

@leibishr
Copy link

leibishr commented Apr 3, 2019

it works using the app password

@djhayes1994
Copy link

I was able to get this to work with MFA using the following for line 41 to 45:

#First, let's get us a cred!
Connect-EXOPSSession

#This connects to Azure Active Directory
Connect-MsolService

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants