Skip to content

Ulysses Neves

Microsoft Entra ID, authentication, and hybrid identity troubleshooting.

Menu
  • Início
  • Microsoft Azure
  • Microsoft AD FS
  • Microsoft 365
  • Contact
Menu

AD FS – Joining a new federation server to an existing AD FS farm using PowerShell

Posted on 21 de February de 2021

Hi mates. Today we’re going to explain how to add a new federation server to an existing AD FS farm using PowerShell. These steps can be useful in case you want to automate your AD FS farm deployment.

Importing the SSL certificate WITH the private key

Before installing and configuring the AD FS role, we need to import the SSL certificate WITH the private key. Once you have the certificate, follow steps below:

Run command below to save the password used to protect the certificate into a variable:

$mypwd = Get-Credential -UserName 'Enter password below' -Message 'Enter password below'

Enter the certificate’s password.

Execute the command below to import the certificate in the new server:

Import-PfxCertificate -FilePath C:\temp\cert.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $mypwd.Password

Validating certificate in the store cert:\LocalMachine\My

Make sure SSL certificate was successfully imported into the server running the command below:

Get-ChildItem -Path cert:\LocalMachine\My | FL FriendlyName, Thumbprint, Subject, NotBefore, NotAfter

Install AD FS role

Run command below on the new server:

Install-windowsfeature adfs-federation –IncludeManagementTools
O atributo alt desta imagem está vazio. O nome do arquivo é image-48-1024x93.png

Run following command in the primary AD FS server to identify the service account used by the AD FS service:

Get-ItemProperty -Path HKLM:\SYSTEM\CURRENTCONTROLSET\SERVICES\ADFSSRV | Select ObjectName 

AD FS with WID database: Run command below updating the parameters marked in bold according to your infrastructure:

$fscredential = domain\adfs-service-account
Add-AdfsFarmNode -OverwriteConfiguration -PrimaryComputerName "primary-adfs-fqdn" -GroupServiceAccountIdentifier $fscredential -CertificateThumbprint "CERTTHUMBPRINT"

AD FS with SQL database: Run command below updating the parameters marked in bold according to your infrastructure:

$fscredential = domain\adfs-service-account
Add-AdfsFarmNode -ServiceAccountCredential $fscredential -SQLConnectionString "Data Source=SQLHost;Integrated Security=True"

With the successful result, look for event 348 in the event viewer of the new AD FS server:

Validating Sync process through PowerShell

Note: If you run AD FS with SQL database, ignore this step.

Run command below to see the sync status between the secondary and primary AD FS servers:

Get-AdfsSyncProperties

Summary

In this article, we covered how to add a new federation server to an existing AD FS farm using PowerShell.

I hope you have enjoyed reading this article, and it helps you to manage your AD FS environment.

Enjoyed the article? Like and share. 🙂

In case you have any suggestion or feedback, please leave a comment.

[ ]’s

Ulysses Neves

6 thoughts on “AD FS – Joining a new federation server to an existing AD FS farm using PowerShell”

  1. Pingback: bahis siteleri
    1. Uneves says:
      10 de June de 2022 at 10:39

      Thank you for the feedback! I am happy that it helped you!

      Reply
  2. JohnDoeZero says:
    20 de July de 2022 at 04:40

    Hi Ulysses. Got through your article and I was wondering why you would use the parameter when adding a new node to an existing ADFS farm? Wouldn’t that remove all the existing config from the database (relying parties, etc)?

    Reply
    1. Uneves says:
      23 de July de 2022 at 18:23

      Hi John, thanks for the comment. In fact, no. When using WID database, the command Add-AdfsFarmNode will create a new local database in the new server copying all databases from the primary node. More information on this commando, please check this link: https://docs.microsoft.com/en-us/powershell/module/adfs/add-adfsfarmnode?view=windowsserver2022-ps

      Reply
  3. Tobias Heyl says:
    5 de June de 2023 at 05:17

    Hey Ulysses,

    thanks for your article! A question remains, though: is it correct that when using an external SQL database instead of WID per node each of the members is listed as “Primary”?

    PS C:\> Get-AdfsSyncProperties

    Role
    —-
    PrimaryComputer

    I have two existing WS 2012 nodes, both already say they’re “Primary”, added a 2019 third server, which points to the same SQL database to extend the current setup, but it also states it’s “Primary”. And for the life of it I don’t know how to easily make out which servers are already part of a setup (= ADFS Member Servers). 😐

    Do you have an idea? Thanks!

    Reply
    1. Uneves says:
      9 de June de 2023 at 13:51

      Hello Toabias,

      Thank you for raising the question and for the feedback. In WID scenarios, the primary/secondary architecture is required, since the database is hosted locally and replicated to secondary nodes. When the AD FS databases are hosted on SQL servers/clusters, there is no such limitation. As per public doc, You do not need to set the primary AD FS server using Set-AdfsSyncProperties -Role when using SQL as the database. This is because all of the nodes are considered primary in this configuration. Reference: https://learn.microsoft.com/en-us/windows-server/identity/ad-fs/deployment/upgrading-to-ad-fs-in-windows-server-sql#remove-the-windows-server-2012-r2-ad-fs-server

      In regard to your statement ‘ I don’t know how to easily make out which servers are already part of a setup (= ADFS Member Servers).’, if you have both AD FS running on 2012 R2 and 2019, you have a Mixed-mode AD FS farm. it’s considered to be temporary and has some limitations in terms of features. On AD FS running on 2016 and above, the command ‘Get-AdfsFarmInformation | select FarmNodes’ gives you the list of AD FS servers reporting in the farm, but this command is not available on 2012 R2 versions. In such cases, if you want to identify the AD FS servers connected to the SQL server, I would suggest checking in the SQL servers the incoming connections to the AD FS databases.

      I hope the information above clarified your concern. 🙂

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Microsoft Authenticator Will Block Jailbroken Devices in 2026 — What You Need to Know 17 de March de 2026
  • Enhancing Azure role activation security with FIDO2/Passkeys 23 de September de 2024
  • Microsoft Entra ID CAP | Enforcing WHfB using Authentication Strength 21 de April de 2024
  • Troubleshooting Error Code ‘0x000005e’ in WHfB: PIN Authentication Woes 11 de February de 2024
  • WHfB: Fixing Windows Hello for Business error ‘LogoncertTemplateReady: NO (StateNoTemplate)’ 29 de December de 2023

Archives

  • March 2026
  • September 2024
  • April 2024
  • February 2024
  • December 2023
  • September 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019

Tags

#aaddownleveldevice #aadhybridjoin #adfs #adfsonsql #azuread #azureauth #azureCA #azuredevice #azurehybridjoin #azuremfa #azuresecurity #capolicy #cloudkerberostrust #conditionalaccess #conditionalaccesspolicy #deviceregistration #gmsaaccount #gopasswordless #hybridaadjoin #mfaserver #msadfs #msazure #msidentity #namedlocation #sslcertificatevalidation #tshootadfs #tshoothybridjoin #tshootwaptrust #waptrust #WHFBcerttrust #whfbdeployment #WHfBhybridsetup #widdatabase adconnect authenticationcontext authenticationstrength az500 azuread azuremfa azurepim azuresecurity cloudsecurity microsoft365 msazure WHfB
©2026 Ulysses Neves | Design: Newspaperly WordPress Theme
Ulysses Neves
Gerenciar Consentimento de Cookies
Para fornecer as melhores experiências, usamos tecnologias como cookies para armazenar e/ou acessar informações do dispositivo. O consentimento para essas tecnologias nos permitirá processar dados como comportamento de navegação ou IDs exclusivos neste site. Não consentir ou retirar o consentimento pode afetar negativamente certos recursos e funções.
Funcional Always active
O armazenamento ou acesso técnico é estritamente necessário para a finalidade legítima de permitir a utilização de um serviço específico explicitamente solicitado pelo assinante ou utilizador, ou com a finalidade exclusiva de efetuar a transmissão de uma comunicação através de uma rede de comunicações eletrónicas.
Preferências
O armazenamento ou acesso técnico é necessário para o propósito legítimo de armazenar preferências que não são solicitadas pelo assinante ou usuário.
Estatísticas
O armazenamento ou acesso técnico que é usado exclusivamente para fins estatísticos. O armazenamento técnico ou acesso que é usado exclusivamente para fins estatísticos anônimos. Sem uma intimação, conformidade voluntária por parte de seu provedor de serviços de Internet ou registros adicionais de terceiros, as informações armazenadas ou recuperadas apenas para esse fim geralmente não podem ser usadas para identificá-lo.
Marketing
O armazenamento ou acesso técnico é necessário para criar perfis de usuário para enviar publicidade ou para rastrear o usuário em um site ou em vários sites para fins de marketing semelhantes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Ver preferências
  • {title}
  • {title}
  • {title}