The connection to adfs.domain.com Active Directory Federation Services 2.0 server failed due to invalid credentials

Are you getting a “failed due to invalid credentials” in PowerShell when executing Set-MsolADFSContext?

PS C:\Windows\system32> Set-MsolADFSContext -Computer adfs.intune-demo.com
Set-MsolADFSContext : The connection to adfs.publicdomain.com Active Directory
Federation Services 2.0 server failed due to invalid credentials.

Try the following:

  1. Start Windows PowerShell as an administrator and set up Windows PowerShell for remoting by typing Enable-PSRemoting –force
  2. Open port 5985 on your server firewall.
  3. Make sure to specify a logfile when entering the command: Set-MsolADFSContext -Computer adfs.publicdomain.com -logfile c:\log.txt
  4. Telnet from a remote location to the ADFS server on port 5985, a blinking cursor is good.
  5. In case this is a server hosted in Azure, configure an endpoint:

image

Consider leaving a reply in case this post helped you. Thanks!