If for whatever reason you need to change your SharePoint Workflow Manager's SQL connection strings (there are 3 for SB and 3 for WF farm), here is what you have to do:
- Run Get-SBFarm and Get-WFFarm PowerShell cmdlets and record all the outputs. This is very important and you will need the information to finalize the script below.
- Remove all your servers from the existing Workflow Manager and Service Bus farms. You can do this via Workflow Manager's configuration wizard.
- Run Restore-SBFarm, Restore-SBMessageContainer, and Restore-WFFarm cmdlet with the new SQL connection strings and SB and WF farms' configuration database names.
- Add the servers back to Workflow Manager and Service Bus farms, You can do this via Workflow Manager's configuration wizard.
- Run Get-SBFarm, Get-SBMessageContainer and Get-WFFarm PowerShell cmdlets to confirm the new connection strings.
- Remove the old SB and WF farm databases.
The above steps and scripts will restore the existing SB and WF farms to new SB and WF configuration DBs with all certificates intact therefore you do not need to re-register with SharePoint again. They are tested with SharePoint 2013 only and I hope it works for SharePoint 2016 as well.
Below is the script you for step #3:
### Restoring SB Farm
Restore-SBFarm -FarmCertificateThumbprint <SB farm cert thumbprint> -GatewayDBConnectionString '<new SB gateway db connection string>' -SBFarmDBConnectionString '<new SB farm db connection string (must provide a new database name)>' -EncryptionCertificateThumbprint <SB encryption cert thumbprint> -RunAsAccount '<SB run as account>';
Restore-SBMessageContainer -Id 1 -ContainerDBConnectionString '<new SB container db connection string>';
### Restoring WF Farm
Restore-WFFarm -OutboundCertificateThumbprint <outbound cert thumbprint> -SslCertificateThumbprint <SSL cert thumbprint> -EncryptionCertificateThumbprint <encryption cert thumbprint> -RunAsAccount '<run as account>' -WFFarmDBConnectionString '<new farm db connection string (must provide a new database name)>' -InstanceDBConnectionString '<new instance db connection string>' -ResourceDBConnectionString '<new resource db connection string>' -InstanceStateSyncTime '<date time>' -ConsistencyVerifierLogPath '<file path>';