Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.

  • 2 Followers
  • 3 Replies |
  • This post has 1 verified answer |
Answered (Verified) This question is answered

I'm using code on http://code.msdn.microsoft.com/office365/Office-365-Manage-users-by-cfc96d5e to connect to Office 365 via c# web application

 

I'm getting this exception on the Pipeline.Invoke method on the Connect-MsolService cmdlet:

Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.

Already done so far:

  • Installed/enabled the required software (NET Framework 3.5, Microsoft Online Services Sign-In Assistant (64 bit), Microsoft Online Services Module for Windows PowerShell (64 bit))
  • set-executionpolicy remotesigned
  • Using primary admin account to connect
  • Using a Windows 2008 R2 64 bit machine.
  • Targeting 64 bit processor in VS, and .NET framework 4.5
  • IIS apppool for this web application is set to use .NET framework 4.0

I can successfully execute connect-msolservice and run cmdlets on the Microsoft Online Services Module for Windows PowerShell on the same machine, using same account.

 

What else can I try?

 

  • Post Points: 20
Verified Answer
  • Hi greatbear302,

    Have you deployed SSO with Office 365? If so, I suggest you create a non-federated admin user with domain .onmicrosoft.com to test it. Here's a KB article for more information about connecting to MSOL service under SSO environment http://support.microsoft.com/kb/2494043.

    I have searched another similar issue with a ASP.NET solution, which has been resolved by changing the Load User Profile to true in the app pool in IIS. You may also try looking for similar settings in your solution.

    Meanwhile, I would like to say that there are limited resources for programming issues in this forum, and a lot of great information can be seen in MSDN and TechNet. I recommend you ask this question in MSDN for a better response.

    MSDN forum http://social.msdn.microsoft.com/forums/en-us/categories

    Thanks,
    Reken Liu 

    • Top 25 Contributor
    • Male
    • Post Points: 0
All Replies
Page 1 of 1 (4 items)