Saturday, July 2, 2016

Attempting to use Windows Azure Active Directory Module for Windows PowerShell "Connect-MsolService" to connect to Azure throws the error: "Connect-MsolService : Method not found: 'Void"

Problem

You attempt to use the cmdlet Connect-MsolService in Windows Azure Active Directory Module for Windows PowerShell to connect to Azure but receive the following error:

PS C:\> Connect-MsolService
Connect-MsolService : Method not found: 'Void
System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr, !!0)'.
At line:1 char:1
+ Connect-MsolService
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Connect-MsolService], Mis
   singMethodException
    + FullyQualifiedErrorId : System.MissingMethodException,Microsoft.Online.A
   dministration.Automation.ConnectMsolService

PS C:\>

image

Solution

One of the reasons why this error would be thrown is if you have an outdated Microsoft .NET Framework 4.5 on the operating system you are trying to connect from. If you are using Microsoft .NET Framework 4.5 as shown in the screenshot below then proceed by downloading Microsoft .NET Framework 4.5.2 and install it to correct the problem:

image

image

No comments: