Exporting your ADFS Relying Party Trust configuration

Read Time 3 mins | Written by: Kenneth Hough

A quick search on exporting your ADFS relying party trust as an XML results in the command Get-AdfsRelyingTrust -Name.  Although this command is correct, you may run into an error indicating the command cannot be found. So, you figure that some ADFS module is missing, and continue your search for a solution.

In the example below, I have a Windows Server 2012r2 with ADFS version 3.0 configured where I encountered the missing command error. Let’s find out how to resolve the multiple issues I ran into last time I was exporting my configuration file.

Step 1. Add-PSSnapin Microsoft.Adfs.PowerShell

What you’ll soon find after some searching is that you need to add a PowerShell snap-in for ADFS.  This sounds straight forward, however, when executing Add-PSSnapin Microsoft.Adfs.PowerShell with elevated permission you get another error… 

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 4

Add-PSSnapin Microsoft.Adfs.PowerShell

Step 2. Get-PSSnapin -Registered (just skip…)

Really, I recommend skipping this step.  Although many search results suggest you to confirm you have the snap in, the error states it’s missing in the first place so I doubt you’ll find much. In my scenario, running the command returned an empty list. 

Step 3. Get-Module -ListAvailable

If all the above suggestions that you encountered have failed, try running the Get-Module -ListAvailables command to get a list of available modules.  In the example below, you will see that ADFS is listed at the top – that’s good news!

Step 4. Get-Command -Noun “ADFS”

After confirming that the ADFS module is available, you’re ready to load it by running the Get-Command -Noun "ADFS". This command let’s you import all commands and functions that include the specified noun.

See the Microsoft documentation for more details: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/get-command?view=powershell-7.1

Step 5. Get-AdfsRelyingTrust

Finally, the only command left to run is to export your Relying Party Trust configuration and save as an XML.

(Get-AdfsRelyingTrust -Name <NameOfMyRelyingPartyTrust>) | Export-CliXML <SomePath>

And…voilà! Hopefully this article was helpful in resolving your issues with exporting your Relying Party Trust configurations.

A Framework Built to Accelerate App Development for Startups

Kenneth Hough


I founded KeyQ in March of 2020 with the vision of helping businesses achieve the next level of success through delivering innovative and meaningful cloud solutions. Since its inception, I have worked with several businesses, non-profit organizations, and universities to design and build cloud applications that have helped streamline their business processes and reduce costs.

Prior to KeyQ, I was a medical researcher at the University of Alabama at Birmingham (UAB) in the Division of Pulmonary, Allergy, and Critical Care Medicine. UAB is also where I worked on my doctoral thesis under the mentorship of Dr. Jessy Deshane and Dr. Victor Thannickal. During my doctoral work at UAB I was exposed to the “omics” and big data, which has influenced my career choice to develop data-driven analytics platforms in the cloud.

I also have to give a big shoutout to my undergraduate education at Worcester Polytechnic Institute (WPI), where I majored in biochemistry. WPI’s motto is “Lehr und Kunst,” which roughly translates to “Theory and Practice” or “Learning and Skilled Art.” WPI truly cherishes and upholds this pedagogy, which can be seen by the teaching styles and class sizes. The learning experience I had at WPI is unique and has shaped me to be who I am, being able to learn, practice and apply.

Personal Interests

I love to learn innovative technologies and try new things. I have a broad area of interests that include serverless architectures, machine learning, artificial intelligence, bioinformatics, medical informatics, and financial technology. I am also working towards my CFA level 1 exam for 2021. Other interests and hobbies include traveling, rock climbing, rappelling, caving, camping and gardening!