0

Has anybody used ADFS 2016 (4.0) API from C#. We have a small application using ADFS 3.0 and it works fine. Now we try to update it to ADFS 4.0. The architecture is a bit complex and it uses reflection.

The assembly used is Microsoft.IdentityServer.Management. There is not much information about it. The assembly is loaded and the difference comes when a command is invoked. In 4.0 the invoke fails with a message

"Cmdlets derived from PSCmdlet cannot be invoked directly".

Any tips using Microsoft.IdentityServer.Management from C# are appreciated.

Tapani
  • 1
  • 1
  • I think you need to provide some more information. How exactly are you attempting to invoke the power shell Cmdlets. Here is a link to an issue similar to yours. Sounds like you are attempting to execute them directly when you need to host a power shell instance in your application and execute them via that, http://stackoverflow.com/questions/12712196/run-pscmdlets-in-c-sharp-code-citrix-xendesktop – Bearcat9425 Feb 27 '17 at 21:28
  • Thank you Bearcat9425. I have seen this article and a couple of similar ones. My question was not well posed. The goal is to use Microsoft.IdentityServer.Management.dll to manage ADFS 4.0 from C#. It happened to work with a "PowerShell API" in ADFS 2.0 and 3.0. There is no documentation about the 4.0 API and what has changed. If PowerShell style API does not work maybe there is some other way to use it. – Tapani Feb 27 '17 at 23:05
  • More details: Today debugged both Microsoft.IdentityServer.Management.dll versions (3.0 and 4.0) and found out the API has been changed. In 3.0 version the commands are derived from System.Management.Automation.Cmdlet, which in turn is derived from System.Management.Automation.Internal.InternalCommand. In 4.0 version the commands are derived from Microsoft.IdentityServer.Management.Commands.PSCmdletBase, which in turn is derived from System.Management.Automation.PSCmdlet. I have not found any documentation or samples on the new ADFS 2016 (4.0) API. – Tapani Feb 28 '17 at 13:08

0 Answers0