SOLVED

Authenticating to O365 using Powershell and MFA

Steel Contributor

I am running into issues with autheticating to O365 on Powershell and in this case my account has been enabled with MFA.
I already installed the preview from https://blogs.technet.microsoft.com/enterprisemobility/2015/10/20/azure-ad-powershell-public-preview... and the authentication basically works but then comes in the question on how to authenticate with Exchange Online? I found a post already where a MSFT engineer states that the only way here would be to create a dedicated admin account without MFA enabled but we strictly enabled MFA on admin accounts for security reasons.
I noticed that there are no plans on uservoice (but some suggestions) to enable this. Has anyone already found another solution (except for creating another account without MFA)?

25 Replies
Hi Dean,

can you explain how to use -UserWebLogin parameter correctly?
E.g.
i would like to replace it in
Connect-PnPOnline -Url https://contoso.sharepoint.com -Credentials (Get-Credential)

I'm having issues using Microsoft O365 reporting with MFA.

I specifically use the MailProtectionReport (Excel) and it does not seem to support MFA.

Has anyone seen a fix for this?

I do have another admin whose all his reports are run automatically. What will he have to change or will this affect his automatic reports?

how we can send message through send-mail message with mfa

You can't. That cmdlets/method was created years before MFA was even a thing.

even send-message not working without MFA. Failed with the error message " No mailbox available". any thoughts

@Mike Platvoet 

Microsoft has released EXO V2 preview module for non-interactive PowerShell scripts using Modern authentication/MFA.
For module installation and usage, you can check here: Exchange Online non-interactive authentication using MFA account