Clean up and Re-register with SPWFM
Use this procedure to remove the connection from SharePoint to SharePoint Workflow Manager (SPWFM) and recreate it.
Overview
In certain scenarios, you may have to clean up some things on the SharePoint side in order to properly register with the SharePoint Workflow Manager (SPWFM) farm using the Register-SPWorkflowService command. Those scenarios may include:
- The SharePoint farm was previously registered with a different WFM or SPWFM farm.
- The SPWFM farm was restored from backup to different hardware.
- The SPWFM endpoint URI changes.
- For example, maybe you had to replace your SPWFM server, and as a result the endpoint URI changed from
https://app01.contoso.local:12290
tohttps://spwfm.contoso.local:12290
. - Or maybe you’re switching from HTTP (port 12291) to HTTPS (port 12290).
- Or maybe you’re adding two more SPWFM servers to your workflow farm and want to switch to a load-balanced URI.
- For example, maybe you had to replace your SPWFM server, and as a result the endpoint URI changed from
- You need to run Register-SPWorkflowService, but it fails with error "Failed to register because the farm or partition is already registered with a workflow service".
Steps
- Check the Scope name by running PowerShell on one of the SharePoint servers:
Add-PSSnapin *sharepoint*
# Get the current Scope name
$site = (Get-SPWebapplication -IncludeCentralAdministration | ?{$_.IsAdministrationWebApplication}).Sites[0]
$wfmProxy = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq "Workflow Service Application Proxy"}
$wfmProxy.GetWorkflowServiceAddress($site)
It should display an address like https://apps.contoso.local:12290/SharePoint/
The part after the port number is the scope name. In this example, it’s SharePoint
- Run the following PowerShell on one of the SharePoint servers to remove the SharePoint-side pieces. This includes:
- The Workflow Service Application Proxy
- The Workflow Trusted Security Token Issuer
- The Trust for the Workflow Outbound Certificate
Note: All pieces you are deleting here will be recreated when you run Register-SPWorkflowService.
# Clean up the WF Service App Proxy
$WFP = Get-SPServiceApplicationProxy | ? {$_.typename -match "workflow"}
if($WFP)
{Remove-SPServiceApplicationProxy $WFP -RemoveData -Confirm:$false}
# Clean up the WF Token Issuer
$TI = Get-SPTrustedSecurityTokenIssuer | ? {$_.name -eq "00000005-0000-0000-c000-000000000000"}
if($TI)
{Remove-SPTrustedSecurityTokenIssuer $TI -Confirm:$false}
# Clean up the WF outbound cert trust
$TRAs = Get-SPTrustedRootAuthority | ? {$_.name -match "00000005-0000-0000-c000-000000000000"}
if($TRAs)
{foreach ($TRA in $TRAs)
{$TRA.Delete()}}
- Make sure the SPWFM farm you’re connecting to is in good standing.
- Run
Get-WFFarm; Get-WFFarmStatus; Get-SBFarm; Get-SBFarmStatus
on the SPWFM server and check output. - Verify you can connect to the SPWFM endpoint URI from the SharePoint servers.
- Re-register the SharePoint farm with SPWFM. This should re-create all the things that were removed in step 2 above. Example:
# Register the WF service to re-create it all
$Scope = "SharePoint" # Use the Scope Name you noted above in the "check the scope" step
$site = "http://sp/" # Any site in the SharePoint web app
$wfURI = "https://spwfm.contoso.local:12290" # Get this value by running "Get-WFFarm | select endpoints" on the SPWFM server
Register-SPWorkflowService -SPSite $site -WorkflowHostUri $wfURI -ScopeName $Scope -Force
Lite Version
If running a PowerShell script to delete objects you’re not familiar with makes you uneasy (it should), you can use these steps instead. It’s not quite as thorough, but slightly less risky, and usually "good enough".
- Check the Scope name (see Step 1 above).
- In Central Administration, go to "Manage Service Applications". Find the "Workflow Service Application Proxy" and delete it.
Important: select the proxy, not the service application itself.
Click on the line for the proxy and select "Delete" in the Ribbon.
Select the check box for "Delete data associated with the Service Application Connections" and click OK.
- Complete Step 3 above to make sure your workflow farm is healthy.
- Complete Step 4 above to Register.
- Run the "Refresh Trusted Security Token Services Metadata feed" timer job. You can do that easily with PowerShell:
$tj = Get-SPTimerJob | ? {$_.name -match "RefreshMetadataFeed"}
Start-SPTimerJob $tj