Jorge's Quest For Knowledge!

All You Need To Know About Identity And Security On-Premises And In The Cloud. It's Just Like An Addiction, The More You Have, The More You Want To Have!

(2016-07-02) The Export Script “Export-FederationConfiguration.ps1” Throws An Error in ADFS v3

Posted by Jorge on 2016-07-02


With ADFS v3.0 (ADFS in Windows Server 2012 R2), Microsoft has provided an export script (“Export-FederationConfiguration.ps1”) and an import script (“Import-FederationConfiguration.ps1”). Both scripts can be found in the folder “C:\Windows\ADFS”. The scripts are to be used to support the migration from ADFS v2.x to ADFS v3.0. The export script should be used on ADFS v2.x and the import script should be used on ADFS 3.0

As you may have read in this blog post you need to export and import the configuration when moving from SQL-based ADFS to WID-based ADFS.

However, when running the export script on ADFS v3.0, you will see the following error

image

Figure 1: Error When Running The Export Script “Export-FederationConfiguration.ps1” On ADFS v3.0

Unable to find type [Microsoft.IdentityServer.PowerShell.Resources.RelyingPartyTrust]. Make sure that the assembly that contains this type
is loaded.
At C:\Windows\ADFS\Export-FederationConfiguration.ps1:1220 char:9
+         $rpTrusts = [Microsoft.IdentityServer.PowerShell.Resources.RelyingPartyT …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Ident…lyingPartyTrust:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

Unable to find type [Microsoft.IdentityServer.PowerShell.Resources.RelyingPartyTrust]. Make sure that the assembly that contains this type
is loaded.
At C:\Windows\ADFS\Export-FederationConfiguration.ps1:1220 char:9
+         $rpTrusts = [Microsoft.IdentityServer.PowerShell.Resources.RelyingPartyT …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Ident…lyingPartyTrust:TypeName) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TypeNotFound

The reason for not working?

The reason the export script does not work in ADFS v3 has to do with a reference to an assembly that does not exist in ADFS 3.0, but only ADFS v2.x

The solution?

A guy named Jeff Patton, already published a fixed version of the script. You can find it on Github: https://gist.github.com/jeffpatton1971/12f9e00dbca27abf8b59

Cheers,
Jorge
———————————————————————————————
* This posting is provided "AS IS" with no warranties and confers no rights!
* Always evaluate/test yourself before using/implementing this!
* DISCLAIMER:
https://jorgequestforknowledge.wordpress.com/disclaimer/
———————————————————————————————
############### Jorge’s Quest For Knowledge #############
#########
http://JorgeQuestForKnowledge.wordpress.com/ ########
———————————————————————————————

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: