Error when you run the Convert-MsolDomainToStandard cmdlet: Failed to connect to Active Directory Federation Services 2.0 on the local machine

This article provides a resolution to resolve an issue where you receive "Failed to connect to Active Directory Federation Services 2.0 on the local machine" error when converting a domain from federated to managed using Convert-MsolDomainToStandard cmdlet.

Applies to:   Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012
Original KB number:   3018485

Note

Azure AD and MSOnline PowerShell modules are deprecated as of March 30, 2024. To learn more, read the deprecation update. After this date, support for these modules are limited to migration assistance to Microsoft Graph PowerShell SDK and security fixes. The deprecated modules will continue to function through March, 30 2025.

We recommend migrating to Microsoft Graph PowerShell to interact with Microsoft Entra ID (formerly Azure AD). For common migration questions, refer to the Migration FAQ. Note: Versions 1.0.x of MSOnline may experience disruption after June 30, 2024.

Symptoms

When you run the Convert-MsolDomainToStandard cmdlet to convert a domain from Federated to Managed, you receive the following error message:

Failed to connect to Active Directory Federation Services 2.0 on the local machine.
Please try running Set-MsolADFSContect before running this command again.

Cause

This problem occurs if the server on which you're running the Convert-MsolDomainToStandard cmdlet is not running Active Directory Federation Services (AD FS).

Resolution

Do one of the following, as appropriate for your situation:

  • If AD FS is still running, use the Set-MsolADFSContext cmdlet to specify the server on which AD FS is running.

    For example:

    Set-MsolADFSContext -Computer <ServerName>
    

    For more information about the Set-MsolADFSContext cmdlet, see Set-MsolADFSContext.

  • If AD FS is not running, use the Set-MsolDomainAuthentication cmdlet to change the domain to a managed domain.

    For example:

    Set-MsolDomainAuthentication -DomainName <DomainName> -Authentication Managed
    

    For more info about the Set-MsolDomainAuthentication cmdlet, see Set-MsolDomainAuthentication.

More information

Still need help? Go to Microsoft Community or Microsoft Entra Forums website.