Share via


ADFS Service cannot start after detaching the WID

Question

Wednesday, December 5, 2018 9:50 PM

I am in the middle of the process to migrate the WID to a SQL express server (for testing purpose, we use Express 2017 for simplicity).  ADFS and SQL servers are windows 2016.  Environment includes 2 LB, 2 ADFS servers (secondary is offline). 

I followed this procedure:

https://social.technet.microsoft.com/wiki/contents/articles/23563.windows-server-2012-r2-ad-fs-migrate-your-ad-fs-configuration-database-from-wid-to-sql-server.aspx

When I ran this command on primary ADFS server as says on step 14:

Set-AdfsProperties -ArtifactDbConnection "Data Source=adfsSQL\SQLEXPRESS;Initial Catalog=AdfsArtifactStore;Integrated Security=True"

I received this error:

Set-AdfsProperties : Could not connect to net.tcp://localhost:1500/policy. The connection attempt lasted for a time
span of 00:00:02.0001736. TCP error code 10061: No connection could be made because the target machine actively
refused it 127.0.0.1:1500.
At line:1 char:1
+ Set-AdfsProperties -ArtifactDbConnection "Data Source=adfsSQL\SQLEXPR ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Set-AdfsProperties], EndpointNotFoundException
    + FullyQualifiedErrorId : Could not connect to net.tcp://localhost:1500/policy. The connection attempt lasted for
   a time span of 00:00:02.0001736. TCP error code 10061: No connection could be made because the target machine acti
  vely refused it 127.0.0.1:1500. ,Microsoft.IdentityServer.Management.Commands.SetServicePropertiesCommand

For step 13, here are my commands and result:

PS C:\Windows\system32> $temp= GEt-WmiObject -namespace root/ADFS -class SecurityTokenService
PS C:\Windows\system32> $temp.ConfigurationdatabaseConnectionstring="data source=adfsSQL\sqlexpress;initial catalog=adfs
configurationV3;integrated security=true"
>>
PS C:\Windows\system32> $temp.put()
>>


Path          : \\localhost\root\ADFS:SecurityTokenService=@
RelativePath  : SecurityTokenService=@
Server        : localhost
NamespacePath : root\ADFS
ClassName     : SecurityTokenService
IsClass       : False
IsInstance    : True
IsSingleton   : True

I wonder why in the procedure page that I followed, it doesn't mention to restart the ADFS service after detaching the db on WID server and copying the ADFS databases to SQL server.  I tried to issue Get-ADFSsyncProperties command, i get the same error as above.  I figure perhaps because the ADFS service is not started, so I tried to restart the ADFS service, it failed to start up.  The service did not report an error.

On the ADFS server, I am able to use SSMS to connect to the ADFSsql\express (as server name at login screen).

I am stuck!!  Any idea?

Thanks for all your helps and feedbacks

All replies (1)

Monday, December 10, 2018 5:27 PM ✅Answered

I found a solution.

The document I followed, missed a step to start ADFS service back up.

This link has better steps:

https://social.technet.microsoft.com/wiki/contents/articles/948.ad-fs-2-0-migrate-your-ad-fs-configuration-database-to-sql-server.aspx

After doing this on step 5:

$temp= GEt-WmiObject -namespace root/ADFS -class SecurityTokenService
$temp.ConfigurationdatabaseConnectionstring=”data source=adfssql\sqlexpress; initial catalog=adfsconfiguration;integrated security=true”
$temp.put()

I issued the command to start up the adf service (step 6) then I was able to move on to step 7 with this command line:

 Set-AdfsProperties -ArtifactDbConnection "Data Source=adfsSQL\SQLEXPRESS;Initial Catalog=AdfsArtifactStore;Integrated Security=True"

it works!

Thanks for all your helps and feedbacks