Connect-MsolService Error – The type initializer threw an exception

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

image

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

image

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

image

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.

Other Popular Articles


Set Edge As Default Browser Using Intune

Set Microsoft Edge As Default Browser Using Intune

Getting Started With Entra ID

Getting Started With Entra ID

How To Remove Teams Sharing Toolbar While Presenting

How To Remove Teams Sharing Toolbar While Presenting

Leave a Comment