ADFS Customizations

To extract and put in

Windows PowerShell

Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> Set-AdfsGlobalWebContent –CompanyName "Contoso Corp"

PS C:\Windows\system32> Set-AdfsGlobalWebContent –CompanyName "Crouse Hospital - KRONOS"

PS C:\Windows\system32> get-AdfsProperties

AcceptableIdentifiers                      : {}

AddProxyAuthorizationRules                 : exists([Type ==

.

.

.

.

 

PS C:\Windows\system32> New-AdfsWebTheme –Name KRONOS –SourceName default

Name                    : KRONOS

IsBuiltinTheme          : False

StyleSheet              : {[, System.Byte[]]}

RTLStyleSheet           : {42, 32, 123, 13...}

OnLoadScript            :

Logo                    : {}

Illustration            : {[, System.Byte[]]}

AdditionalFileResources : {[/adfs/portal/script/onload.js, System.Byte[]], [/adfs/portal/images/idp/localsts.png,

                          System.Byte[]], [/adfs/portal/images/idp/idp.png, System.Byte[]],

                          [/adfs/portal/images/idp/otherorganizations.png, System.Byte[]]}

PS C:\Windows\system32> mkdir c:\theme

    Directory: C:\

Mode                LastWriteTime         Length Name

----                -------------         ------ ----

d-----        6/12/2019   3:43 PM                theme

PS C:\Windows\system32> Export-AdfsWebTheme –Name KRONOS –DirectoryPath c:\theme

PS C:\Windows\system32> cd \theme

PS C:\theme> dir

    Directory: C:\theme

Mode                LastWriteTime         Length Name

----                -------------         ------ ----

d-----        6/12/2019   3:43 PM                css

d-----        6/12/2019   3:43 PM                illustration

d-----        6/12/2019   3:43 PM                images

d-----        6/12/2019   3:43 PM                script

PS C:\theme> Set-AdfsWebTheme -TargetName KRONOS -OnLoadScriptPath "c:\theme\script\onload.js"

PS C:\theme> Set-AdfsWebConfig -ActiveThemeName KRONOS

PS C:\theme>

PS C:\theme> Set-AdfsWebTheme -TargetName KRONOS -Logo @{path="\icon.png"}

https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/ad-fs-user-sign-in-customization


Example 1: change “Sign in with organizational account” string

// 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 company description text'; 

} 


Example 2: Accept SAM-account (sAMAccountName) name as a login format on an AD FS form-based sign-in page

if (typeof Login != 'undefined'){ 

    Login.submitLoginRequest = function () {  

    var u = new InputUtil(); 

    var e = new LoginErrors(); 

    var userName = document.getElementById(Login.userNameInput); 

    var password = document.getElementById(Login.passwordInput); 

    if (userName.value && !userName.value.match('[@\\\\]'))  

    { 

        var userNameValue = 'contoso.com\\' + userName.value; 

        document.forms['loginForm'].UserName.value = userNameValue; 

    } 

 

    if (!userName.value) { 

       u.setError(userName, e.userNameFormatError); 

       return false; 

    } 

 

    if (!password.value)  

    { 

        u.setError(password, e.passwordEmpty); 

        return false; 

    } 

    document.forms['loginForm'].submit(); 

    return false; 

}; 

} 

Example 3:  Clear or set the placeholder text (username@example.com) from displaying

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';

https://deploywindows.com/2015/05/05/customize-your-adfs-login-page/

Example 4: Add Custom Text under the login box/Sign in box 

Set-AdfsGlobalWebContent -SignInPageDescriptionText "<b>Please note:</b><br>As of 11/16/2019, this is the new Lawson sign-in page."

Example 5: Add Logo to the screen

Set-AdfsWebTheme -TargetName custom_theme -Logo @{path="C:\ADFS\custom_theme\logo\crouse-nwh-logo.png"}

Example 6: Add Illustration to the screen

Set-AdfsWebTheme -TargetName custom_theme -Illustration @{path="C:\ADFS\custom_theme\illustration\crouse-illustration.png"}

Add Supported Agent Strings (for SSO)

Admin PowerShell

Set-ADFSProperties -WIASupportedUserAgents (((Get-ADFSProperties).WIASupportedUserAgents)+'Mozilla/4.0')

Get Metadata

https://kronos.crouse.org/FederationMetadata/2007-06/FederationMetadata.xml

Set Certificate - Service Communication


Set-AdfsCertificate -CertificateType "service-communications" -Thumbprint "A09200F388EEDE377ED971D33A6D20E8D5D97922"
Set-AdfsSslCertificate  -Thumbprint  a09200f388eede377ed971d33a6d20e8d5d97922

Set Certificate - ADFS SSL

Set-AdfsSslCertificate  -Thumbprint  a09200f388eede377ed971d33a6d20e8d5d97922