
How to connect in PowerShell on Office 365
13 November 2019PowerShell Office 365 allows you to manage your Office 365 settings from the command line.
You must :
Thank you for reading this post, don't forget to subscribe!
- Use PowerShell version 5.1 or later.
- Use a 64-bit version of Windows. Support for the 32-bit version of the Microsoft Azure Active Directory Module for Windows PowerShell ceased in October 2014.
Here’s how you can connect:
Open PowerShell is used the following script, for my part I prefer to use PowerShell ISE.
[cc lang=”powershell” tab_size=”2″ lines=”40″]
Import-Module MSOnline
Connect-MsolService -Credential $Credential
$msoExchangeURL = “https://ps.outlook.com/powershell/”
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
$msoExchangeURL -Credential $Credential -Authentication Basic -AllowRedirection
Import-PSSession $session
[/cc]

Do not forget to log out via the following command at the end of the intervention:
[cc lang=”powershell” tab_size=”2″ lines=”40″]
Remove-PSSession $Session
[/cc]
Views: 298