Workflow Manager Server provides the capability to host workflows in a high scale, high density, and multi-tenant environment. These Workflows are authored using an entirely declarative model, using Microsoft .NET Framework 4.5 and Windows Workflow Foundation.
Workflow Manager is generally used by SharePoint Server to run SharePoint Workflows that help people and teams to collaborate on documents and to manage project tasks by implementing business processes on documents and items in a SharePoint site. Workflows help organizations adhere to consistent business processes and improve organizational efficiency and productivity.
Recently, I had an opportunity to work with one of our healthcare customer who wanted to migrate their global collaboration and application platform that consisted of:
- 10 – SharePoint 2013 Servers in various roles and configurations
- 3 – Workflow manager servers configured in a cluster
- 2 – Office WebApp servers
- 2 – Third party application servers
- SQL Cluster with AOAG configured
They had a similar configuration for their Disaster Recovery (DR) environment and had gone the whole nine yards to ensure that their collaboration platform is highly available and stable with 99.99% uptime. However, with this configuration and uptime requirements, it becomes a challenge when we have to plan to either upgrade or migrate such a tightly weaved complex platform.
In our scenario, the plan was to migrate all the data and services as-is to a newer hardware and operating system to keep up with support lifecycles.
In this blog, I will explain the steps required for Migration of workflow manager server configuration and all the workflows with their states to the new workflow farm.
- Ensure that the SharePoint Authentication Realm on the new farm is same as the old farm
- Extract the primary symmetric key from the old workflow farm and store it. We will need this key when restoring Workflow manager service
- Latest backup for the below databases
- Workflow Manager Instance DB
- Workflow Manager Resource Manager DB
- Service Bus Message Container DB
- Service Bus Gateway DB
- Do not back up the Workflow or service bus management databases
- The service account that was running the WFM service
Workflow Manager Migration/Restore approach:
- Install workflow manager on all the servers
- Restore all the databases mentioned above to the SQL Cluster
- Execute the flowing set of commands
$mykey=convertto-securestring ‘WorkfloWRest0r3’ -asplaintext -force
Restore-SBFarm -RunAsAccount ‘contoso\wfmadmin’ -GatewayDBConnectionString ‘Data Source=SQLALIAS;Initial Catalog=ServiceBusGateWay_DB;Integrated Security=True;Encrypt=False’ -SBFarmDBConnectionString ‘Data Source=SPSSQL;Initial Catalog=ServiceBusMGMT_DB;Integrated Security=True;Encrypt=False’ -AdminGroup ‘BUILTIN\Administrators’ -CertificateAutoGenerationKey $myKey
Restore-SBGateway -GatewayDBConnectionString ‘Data Source= SQLALIAS;Initial Catalog=ServiceBusGateWay_DB;Integrated Security=True;Encrypt=False’ -SBFarmDBConnectionString ‘Data Source=SPSSQL;Initial Catalog= ServiceBusMGMT_DB;Integrated Security=True;Encrypt=False’
Restore-SBMessageContainer -ContainerDBConnectionString ‘Data Source= SQLALIAS;Initial Catalog=ServiceBusMsgCnt_DB;Integrated Security=True;Encrypt=False’ -SBFarmDBConnectionString ‘Data Source=SPSSQL;Initial Catalog=ServiceBusMGMT_DB;Integrated Security=True;Encrypt=False’ -Id 1
$myPassword=convertto-securestring ‘P@ssw0rd’ -asplaintext -force
Add-SBHost -EnableFirewallRules $TRUE -RunAsPassword $myPassword -SBFarmDBConnectionString ‘Data Source=SPSSQL; Initial Catalog=ServiceBusMGMT_DB;Integrated Security=True;Encrypt=False’
The above commands restore the Service bus functionality on the new workflow farm and adds the current server into the service bus farm.
Restore-WFFarm -RunAsAccount ‘contoso\wfmadmin’ -InstanceDBConnectionString ‘Data Source= SQLALIAS;Initial Catalog=WFInstanceMgmt_DB;Integrated Security=True;Asynchronous Processing=True;Encrypt=False’ -ResourceDBConnectionString ‘Data Source= SQLALIAS;Initial Catalog=WFMResMgmt_DB;Integrated Security=True;Asynchronous Processing=True;Encrypt=False’ -WFFarmDBConnectionString ‘Data Source= SQLALIAS;Initial Catalog=WFMgmt_DB;Integrated Security=True;Encrypt=False’ -InstanceStateSyncTime ‘Friday, Jan 10, 2018 06:30:00 PM’ -ConsistencyVerifierLogPath ‘c:\temp\log.txt’ -CertificateAutoGenerationKey $myKey -Verbose -SkipConsistencyVerification
Set-SBNamespace -Name “WorkflowDefaultNamespace” -PrimarySymmetricKey “OldfarmPrimarySymmetrickey”
$SBClientConfiguration = Get-SBClientConfiguration -Namespaces ‘WorkflowDefaultNamespace’ -Verbose;
Add-WFHost -WFFarmDBConnectionString ‘Data Source= SPSSQL;Initial Catalog=WFMgmt_DB;Integrated Security=True;Encrypt=False’ -RunAsPassword $myPassword -EnableFirewallRules $TRUE -CertificateAutoGenerationKey $myKey -SBClientConfiguration $SBClientConfiguration -Verbose
After executing the above commands, workflow manager and Service bus functionality will be restored successfully.
Finally execute the below command to register workflow server to the SharePoint farm
Register-SPWorkflowService -SPSite “https://sharepoint.contoso.com” -WorkflowHostUri “https://wfm.contoso.com”