, ,

You need either Windows 7 or Windows Server 2008 R2 with Windows PowerShell and .NET Framework 3.5.1 or higher installed. You’ll also need to download and install the Office 365 Sign-in Assistant. Here’s the links to either the 32 or 64 bit version:
Microsoft Online Services Sign-In Assistant (IDCRL7) – 32 bit version
Microsoft Online Services Sign-In Assistant (IDCRL7) – 64 bit version

Next you will download and install the cmdlets. After you download the appropriate file, double-click the “AdministrationConfig.msi” file.
Microsoft Online Services Module for Windows PowerShell (32-bit version)
Microsoft Online Services Module for Windows PowerShell (64-bit version)

If you got the following error message (although Microsoft Online Services Sign-In assistant version 7.0 is installed)

“In order to install Windows Azure Active Directory Module for Windows PowerShell, you must have Microsoft Online Services Sign-In Assistant version 7.0 or greater installed on this computer”

The workaround solution is to install instead the Microsoft Online Services Sign-In Assistant for IT Professionals BETA:


The installation adds the shortcut titled “Microsoft Online Services Module for Windows PowerShell” to your desktop and the Start Menu. Once the module is installed you can try connecting to Office 365 by following the directions in the previous blog.

If you are facing any problems you may have to enable PowerShell scripts to run on your computer. Type the following command after opening PowerShell as an Administrator:


If the results say anything other than RemoteSigned then run this command:

Set-ExecutionPolicy RemoteSigned

That should enable your computer to connect PowerShell to Office 365. If it doesn’t then go through this TechNet article for further troubleshooting:

Scripting your connection

Once you have finished the above you’re ready to actually connect to your Office365 domain. Here is the syntax that you will need to run:

Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService –Credential $O365Cred

The file at the right contains the code above. If you download it and run it from within Powershell it will get you connected. Otherwise you can use the above to create your own or copy line by line into Powershell.