This article explains How to Connect to Office 365 via PowerShell. There are lot of things you can do from the Portal, however for most of the tasks, you’ll need PowerShell. Please be sure to use it carefully as its a powerful tool, and can do a lot more than you can imagine.
- To login to Office 365 via Azure PowerShell, it’s advised to install the latest version of PowerShell.
- Prerequisite for Azure PowerShell is Microsoft Online Sign-in Assistant. You can download it from here.
- You can install this on Windows 8, Windows 8.1, Windows 7 (SP1)*, Windows Server 2008 R2 (SP1)*
- You can download the Azure PowerShell from the links below:
- Install the Sign-in Assistant, and Azure Active Directory Module, and launch Windows Azure PowerShell as Administrator (ensure that you Run it as Administrator)
- Run the following commands to connect with your Office 365 account:
- Set-ExecutionPolicy = unrestricted
- $cred = Get-Credential -Credential $user
Enter the credentials for your Office 365 Admin account and hit OK.
- Import-Module MSOnline
- Connect-MsolService -Credential $cred
- $msoExchangeURL = “https://ps.outlook.com/powershell/”
- $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection
- Import-PSSession $session
Now you are connected to Office 365 via PowerShell.
Please do not forget to share your feedback, or ask us a question by clicking here.
Latest posts by Rishi Chaudhary (see all)
- ShadowCopy Backup after renaming VSSADMIN.EXE - October 5, 2016
- No Network Connection after Windows 10 Upgrade – Fixed - August 25, 2015
- Windows 10 System Tray Notification Issue - August 7, 2015