How to Customize AD FS Error Messages

Entering a username incorrectly in AD FS results in a reasonably useful error message. However, some folks desire to change this, which is perfectly OK too.

Poking through the HTML behind IdpInitiatedSignon.aspx (the page that is rendered for forms-based authentication to AD FS) shows that the error messages for a) invalid username format, and b) empty password, are both stored in a JavaScript function called LoginErrors().

Fortunately, JavaScript provides great native functionality for overriding inbuilt functions, so we can simply redefine LoginErrors later on. The page will then utilise that in the event of either condition (username format error or empty password) being met. Be sure to follow the approach below that matches your environment:

Default AD FS theme (Create custom theme)

If you don’t already have a custom AD FS theme, why not? They’re a great way to customise the (somewhat bland) default AD FS interface. Let’s create one now! You can use this to apply the customisations here, as well as to update countless other display and functionality features of the AD FS interface.

New-AdfsWebTheme -Name customtheme -SourceName default

Once you’ve created your custom theme, follow the steps below.

Existing custom AD FS theme

If you already have a custom AD FS theme, you’ll want to perform the following steps: