Problem
After installing Azure Active Directory Powershell module, you will get the following error when you connect Azure AD using the cmdlet Connect-MsolService.
Connect-MsolService : Method not found: 'Void System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr, !!0)'. At line:1 char:1 + Connect-MsolService -Credential $cred + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [Connect-MsolService], Mis singMethodException + FullyQualifiedErrorId : System.MissingMethodException,Microsoft.Online.A dministration.Automation.ConnectMsolService
Fix/Solution
For me the issue was fixed after update my .NET to 4.5.2.
You can also try other solutions if the above update does not fix the problem for you. Check this Microsoft forum for more info: Problem to Connect MsolService
Advertisement