Software Architecture – Office 365 – Single sigin-in/synchronization – Directory Federation Services 2.0 server failed due to invalid credentials

July 17, 2011

Software world is changing and growing for new dimensions. Cloud is one the direction which is supposed to be growing a lot in next few years.
Last few months in my office, I have been working on automation of office 365 administrative tasks via power shell commands in C#, a really new learning curve and I enjoyed it.
I made some good social networking with Office 365 experts / MVPs on net. I hit my head with Office 365 support forums for many things. …:)
A small module for office 365 automation is complete and one of the challenging task was a POC to configure Single sigin-in/synchronization for office 365. While working on it, I really realize that it is challenging task.
Problem domain:
Office 365 Enterprise programming via power shell commands via c#
While following steps for single sign-in at: I followed “3. Set up a trust by adding or converting a domain for single sign-on” and ran “MsolAdfscontext” command, I got following error.

Set-MsolADFSContext : The connection to * Active
 Directory Federation Services 2.0 server failed due to invalid credentials.
At line:1 char:20
+ Set-MsolAdfscontext <<<<  -Computer  **
    + CategoryInfo          : InvalidOperation: (:) [Set-MsolADFSContext], Fed
    + FullyQualifiedErrorId : ConnectionToGenevaServerFailed,Microsoft.Online.

The screen looked like as below:

After some googling I came to know that problem lies in “Installation and Configuration for Windows Remote Management”. According to MSDN:

If Windows Remote Management (WinRM) is not installed and configured, WinRM scripts do not run and the Winrm command-line tool cannot perform data operations. The Windows Remote Shell command-line tool, Winrs, event forwarding, and Windows PowerShell 2.0 remoting also depend on WinRM configuration.

So solution is to run command as “Winrm quickconfig” , so the output will be as:

For details visit:
Happy coding for office 365.