How to export an ADFS custom webtheme and import it to another server


As it is recommended on the following TechNet article:

"It is strongly recommended to validate your customizations in an alternate environment and test them prior to rolling it out onto production AD FS servers. This reduces the chances of end users being exposed to these customizations prior to validation."

Unless you have saved all the PowerShell cmdLet you typed to create your custom theme in your pre-production environment, it is quite challenging to recreate the exact same webtheme on your production servers. It is easy to export a configuration with the Export-WebTheme cmdLet. But it does not give you the ability to re-import what you just exported. I wrote the following script to help with that: 

In a nutshell, we create our custom theme in our lab for example. In my case my webtheme is called Yoga. You export it to a folder:

Now you have a folder called C:\WebThemeExport that contains all your customization. Here is the content:

Then you copy this folder to your production server and you import the content:

All custom logos, illustrations, CSS and JavaScript will be imported in an existing theme or in a new theme, your call.

Comments (4)

  1. Amit says:

    I am just looking to export the ADFSWebtheme and came across this article. I see the script is quite explanatory and has many checks inbuilt. I would like to know if this is same as using command for exporting them – Export-AdfsWebTheme -Name "Theme01"
    -DirectoryPath "C:WebTheme" or there is some additional information that we get by using the script?

  2. Good question. The challenge isn’t really to export the webtheme. It is to re-import it. There is no built-in way to import a webtheme into a new webtheme or an existing one. Besides, having the files isn’t enough. If you have added some AdditionalFileResources
    into your original webtheme you also need to export this mapping. And this is what is stored in the config.xml. I will edit the post to recall these challenges hoping it will make more sense for readers. Thanks Amit.

  3. Ian says:

    Hey Pierre, great script, thanks!

    Thought I would give my feedback.

    If you run it without -CreateTheme, it will ask you “Do you want to create it? (Y/N)”. The line 142 needs to be updated to be -and instead of -or, otherwise if you type Y or N it will continue looping.

    Also, my logo file put into ADFS was a .jpg. I used this script to export, and it has logo.jpg in the folder, but the config file has logo.png. I think lines 117 to 125 could be reviewed to capture config information, and then use that for file names.

    But otherwise, thank you!

Skip to main content