User Tools

Site Tools


wiki:connect_exchange_online_microsoft_powershell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:connect_exchange_online_microsoft_powershell [2021/04/07 12:23] – created antisawiki:connect_exchange_online_microsoft_powershell [2021/04/11 11:17] (current) – add MFA setup antisa
Line 18: Line 18:
   -it mcr.microsoft.com/azure-powershell pwsh   -it mcr.microsoft.com/azure-powershell pwsh
 </code> </code>
 +
 +
  
   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 run+===== 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 12:23 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki