wiki:connect_exchange_online_microsoft_powershell
Differences
This shows you the differences between two versions of the page.
wiki:connect_exchange_online_microsoft_powershell [2021/04/07 10:23] – created antisa | wiki:connect_exchange_online_microsoft_powershell [2021/04/11 09:17] (current) – add MFA setup antisa | ||
---|---|---|---|
Line 18: | Line 18: | ||
-it mcr.microsoft.com/ | -it mcr.microsoft.com/ | ||
</ | </ | ||
+ | |||
+ | |||
Install-Module -Name ExchangeOnlineManagement | Install-Module -Name ExchangeOnlineManagement | ||
Line 23: | Line 25: | ||
Import-Module ExchangeOnlineManagement | Import-Module ExchangeOnlineManagement | ||
+ | ===== If you are using username and password run these steps ===== | ||
$UserCredential = Get-Credential | $UserCredential = Get-Credential | ||
Line 38: | Line 41: | ||
Connect-ExchangeOnline -Credential $UserCredential | Connect-ExchangeOnline -Credential $UserCredential | ||
- | After it finished | + | ===== If you are using the MFA setup run this command ===== |
+ | |||
+ | Connect-ExchangeOnline -Device | ||
+ | |||
+ | The command returns a URL and unique code that's tied to the session. You need to open the URL in a browser on any computer, and then enter the unique code. After you complete the login in the web browser, the session in the Powershell 7 window is authenticated via the regular Azure AD authentication flow, and the Exchange Online cmdlets are imported after few seconds. | ||
+ | |||
+ | |||
+ | ===== Test connection ===== | ||
Get-Mailbox | Get-Mailbox | ||
- | to check if it is working. | + | It should return a list of mailboxes. |
====== Tested on ====== | ====== Tested on ====== |
wiki/connect_exchange_online_microsoft_powershell.1617791033.txt.gz · Last modified: 2021/04/07 10:23 by antisa