How to connect MSOL in powershell using App Password?

Occasional Contributor


My global administrators are having MFA enabled account. Is there any possibility to authenticate a user in MSOL using app password? or any other ways to connect-msolservice for MFA account.

Is there any possibilities to get the error as the account is MFA enabled while try to connect msol-service?.

6 Replies
MFA should work, My account is MFA and I don't have issues connecting to powershell. Make sure you have the latest powershell module installed. my accounts are connected to work account but one of them is domain joined not azure ad joined and still can connect.

App passwords are NOT supported, simply use Connect-MsolService without any parameter to trigger the ADAL dialog and complete the 2FA challenge as normal.

Bit of a catch-22 that isn't it. One is recommended to turn on MFA except it makes automated scripts nigh on impossible

We have bypass/exclusions that we can use for that, and almost anything you can do with the MSOL module is already possible via the Graph anyway.

@Vasil Michev ahh yes, only recently started looking at Graph. To be honest, Graph is a bit of a sideways step or maybe slightly backwards compared to PowerShell cmdlets. I assume there is a strong case for using HTTP calls instead of cmdlets? It's almost as if cmdlets have fallen out of favour which is weird considering how much effort has gone into them. At least with Graph, permissions are under control.

REST is supposedly more robust, they are actually working on redoing all the other PowerShell modules in such manner (Azure AD PowerShell is already a "wrapper" for Graph calls). But yeah, the Graph sucks when it comes to searching/filtering data, and definitely lacks the "friendliness" of PowerShell. It's a tool for devs mostly...