Customize your ADFS login page

Posted by

As many of you already know you can customize your ADFS login page, a bit.

The default page looks like this and can be a bit anonymous for your company

image

 

So I will guide you thru some steps to customize your page with PowerShell scripting

First create a company logo with the size 260×35 pixels and 96 dpi and no greater than 10 KB, save it as logo.png

Second to change the illustration on the left you need a picture with the size 1420×1080 pixels and 96 dpi, and no greater than 200 KB, save it as illustration.png

To apply the pictures use these PowerShell commands

Import-Module ADFS
Set-AdfsWebTheme -TargetName default -Logo @{path="c:\temp\logo.png"}
Set-AdfsWebTheme -TargetName default -Illustration @{path="c:\temp\illustration.png"} 

To customize texts and error descriptions you will need to use the cmdlet Set-AdfsGlobalWebContent, like the Description text below the login form

Set-AdfsGlobalWebContent -SignInPageDescriptionText “This is a private domain.<br>Make sure you are <b>authorized</b>”

Other texts you can modify are

Set-AdfsGlobalWebContent –HomeLinkText
Set-AdfsGlobalWebContent -ErrorPageDescriptionText
Set-AdfsGlobalWebContent -ErrorPageGenericErrorMessage
Set-AdfsGlobalWebContent -ErrorPageAuthorizationErrorMessage
Set-AdfsGlobalWebContent –ErrorPageDeviceAuthenticationErrorMessage
Set-AdfsGlobalWebContent –HelpDeskLink
Set-AdfsGlobalWebContent –HelpDeskLinkText
Set-AdfsGlobalWebContent –HomeLink
Set-AdfsGlobalWebContent –HomeLinkText
Set-AdfsGlobalWebContent –PrivacyLink
Set-AdfsGlobalWebContent –PrivacyLinkText

There are some trickier parts that are possible to change as well. For example these changes

image

 

First export the default theme to your computer and create a new ADFS theme with these commands

Import-Module ADFS

Export-AdfsWebTheme -Name default -DirectoryPath c:\Temp\Theme\Custom

New-AdfsWebTheme -Name Custom -SourceName default

Now it’s time to do some scripting, I will not go into details regarding the scripting.

Open the script file you downloaded from “C:\temp\Theme\Custom\script\onload.js” in Notepad

 

Add this line at the bottom of the script to change the placeholder text in the username input box

document.forms[‘loginForm’].UserName.placeholder = ‘Charles@CustomizedDomainName.Net’;

Add these lines at the bottom of the script to add a text above the login form, this is an example from Microsoft that you can find futher down

// Sample code to change “Sign in with organizational account” string.

// Check whether the loginMessage element is present on this page.

var loginMessage = document.getElementById(‘loginMessage’);

if (loginMessage)

{

       // loginMessage element is present, modify its properties.

       loginMessage.innerHTML = ‘Your custom company description text’;

}

When you are done and saved your changes it is time to upload the changes to the new created theme we named Custom

Set-AdfsWebTheme -TargetName Custom -AdditionalFileResource @{Uri=’/adfs/portal/script/onload.js’;path=”c:\temp\Theme\Custom\script\onload.js”}

Now don’t forget to apply the changes to set the active theme with this command

Set-AdfsWebConfig -ActiveThemeName Custom

Use these commands to verify your settings

Get-AdfsWebConfig

Get-AdfsGlobalWebContent

It can look like this when you are done!

image

 

Happy customization!

 

Note this is not a complete guide to all possible customizations that you can do!

 

Source

https://technet.microsoft.com/en-us/library/dn280950.aspx

https://technet.microsoft.com/en-us/library/dn636121.aspx

15 comments

  1. Nice post. I used to be checking continuously this blog and I’m impressed! Very useful info specifically the final phase 🙂 I take care of such information much. I used to be looking for this particular info for a very long time. Thanks and good luck.

    Like

  2. I have noticed you don’t monetize your page, don’t waste your traffic, you can earn extra bucks
    every month because you’ve got high quality content.
    If you want to know how to make extra $$$, search for: Mrdalekjd methods for
    $$$

    Like

  3. Thanks , I have just been looking for info about this subject for a long time and yours is the greatest I’ve discovered till now. However, what concerning the bottom line? Are you positive concerning the source?

    Like

  4. Hi,
    I’m trying to change the size of the left pane on the ADFS Login page. Is there a way to do this. I see there is a way to upload a picture there but couldn’t find anything which could help resize that left pane (also noted as ‘Illustration’ window).

    Like

  5. I’m trying to use the onload.js modifications:

    // Sample code to change “Sign in with organizational account” string.

    // Check whether the loginMessage element is present on this page.
    var loginMessage = document.getElementById(‘loginMessage’);
    if (loginMessage)
    {
    // loginMessage element is present, modify its properties.
    loginMessage = ‘Sign in with your email account’;
    }
    // Code to change “someone@example.com” placeholder in userName input text box.

    var userNameInputTextBox = document.getElementById(‘userNameInput’);

    if (userNameInputTextBox) {

    var placeholderText = ’email.address@mydomain.com’;

    if (userNameInputTextBox.placeholder)

    userNameInputTextBox.placeholder = placeholderText;

    I update it in the custom theme I made in c:\theme

    PS C:\Windows\system32> Set-AdfsWebTheme -TargetName custom -AdditionalFileResource @{Uri=”/adfs/portal/script/onload.js”;path=”C:\theme\script\onload.js”}
    PS C:\Windows\system32> Set-AdfsWebConfig -ActiveThemeName “custom”

    I can see my code in the view source, but the dang elements didn’t change.

    Hoping you may have some insight. I changed it back to “default” theme for now.

    Like

    1. I can’t see anything in your code that seems wrong. Double check all the ” and ‘, these characters maybe messed up when you copy and paste. If it still does not work, send me a message and attach the onload.js and I will try it out.

      Like

Leave a comment

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.