While running Connect-MSolService in Windows Azure Active Directory Module for Windows PowerShell, I was surprised to see the error below. This has worked like a charm in the past!
The type initializer for ‘Microsoft.Online.Administration.Automation.ConnectMsolService’ threw an exception.
At line:1 char:20
+ Connect-MsolService <<<<
+ CategoryInfo : NotSpecified: (:) [], TypeInitializationExceptio
n
+ FullyQualifiedErrorId : System.TypeInitializationException
The issue was that I was using an older version of Microsoft Online Sign-In assistant and Windows Azure Active Directory Module for Windows PowerShell.
You can check the version using control panel -> programs and features. My version of Online Services Sign-In Assistant was 7.250.4303.0 and the latest version is 7.250.4556.0
You can check the Windows Azure AD Module version by running the following command in PowerShell.
(get-item C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
MSOnline\Microsoft.Online.Administration.Automation.PSModule.dll).VersionInfo.FileVersion
My version was 1.0.6694.87. TechNet’s recommended version is 1.0.8070.2. Anything below this version needs to be upgraded.
The fix was to remove the old versions of Windows Azure AD Module and Online Services Sign-In Assistant using the control panel and to install the new versions from here.
Connection was fine after the new binaries were installed.