Forum Discussion
Pawan2055
Jul 30, 2019Copper Contributor
Connect to Exchange Online PowerShell using MFA
Hello , I am not able to connect to exchange online powershell.could you please help on this.
Akshay_Mane
Aug 22, 2019Iron Contributor
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.
- First, MFA requires you to install the Exchange Online Remote PowerShell Module
- Then you need to use the Connect-EXOPSSession cmdlet to connect
Ok, lets see how it works…
- Open the Exchange Online Remote PowerShell Module ( Microsoft Corporation > Microsoft Exchange Online Remote PowerShell Module).
- Run the command, Connect-EXOPSSession –UserPrincipalName deva @ contoso. onmicrosoft. com
This throws the credentials prompt, so provide the password.- A verification code is generated, sent.
- Provide the verification code in Verification window
- After Step 4, the https://www.o365cloudexperts.com/exchange-online-plans/ cmdlets are imported into your Exchange Online Remote PowerShell Module session and tracked by a progress bar.
- If you don't receive any errors, you connected successfully.
- Just to check that, run any of the Exchange cmdlet and see the results.
- Once you’re done and want to disconnect all currently open PowerShell sessions in the current window, run the following command: Get-PSSession | Remove-PSSession
Hope this helps.