Office 365: Connect account with PowerShell

You can also manage Office 365 via PowerShell, which is of course particularly interesting for your own scripts:

First download and install the "Microsoft Online Services Login Wizard":

http://www.microsoft.com/de-DE/download/details.aspx?id=39267

For an operating system in German, the following registry entry must also be set (in my case it was necessary):

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOIdentityCRL] "MSOIDCRLVersion"="7.250.4551.0"

 

Without the registry entry, the following error may occur when installing the Azure module:

image

You need version 7.0 or later of the Microsoft Online Services Logon Wizard if you want to install the Windows Azure Active Directory module for Windows PowerShell on this computer.

After setting the registry entry, the corresponding Azure module for the Powershell must be installed

As soon as the two packages have been installed, the module can be loaded into the Powershell:

MSOnline import modules

image

Then you can connect to the Office365 instance:

Connect-MsolService -Credential (Get-Credential)

image

Now the local PowerShell is connected to Office365 and the CMDLets of the Azure module can be used. A list of all CMDelts can be listed as follows:

get-command *msol*

Office 365

Leave a Comment