I'm using code on http://code.msdn.microsoft.com/office365/Office-365-Manage-users-by-cfc96d5e to connect to Office 365 via a test c# web application which basically connects to azure active directory and tries to execute couple of powershell cmdlets.
I'm getting this exception on the Pipeline.Invoke method on the Connect-MsolService cmdlet in my web app:
Exception of type 'Microsoft.Online.Administration.Automation.MicrosoftOnlineException' was thrown.
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 remote powershell
- Using a Windows 2008 R2 64 bit machine.
- Targeting 64 bit processor in VS, and .NET framework 4.0
- IIS apppool for this web application is set to use .NET framework 4.0
I can successfully execute connect-msolservice and run cmdlets using the Microsoft Online Services Module for Windows PowerShell on the same machine, using same account.
What else can I try?