Advertisements

Workflow Manager Disaster Recovery

Workflow Manager is an added value to the SharePoint 2013, in the previous versions workflow was part of the SharePoint on SharePoint 2013 there are 2 flavors you can use when developing workflows the first one is the SharePoint 2010 workflow and the second and new one is the new workflow manager which is now a separate component, when you install the new workflow manager it will allow to create SharePoint 2013 workflows.

The Architecture of the Workflow Manager depends on several separate databases to save the workflows so now the workflows are stored on those separate databases and not on the content databases so important in any backup and restore to make sure that all those workflows are backed up in case restoration is needed and while restoring there are important steps and scripts that needs to run in certain order to restore the workflow farm correctly.

I will be walking through the steps to restore the workflow farms and the scripts used can be found in this link Scripts

Backup Workflow Manager

There are some components/information which need to be backed up and stored in order to restore workflow manager.

  • Backup the following databases by following the Database backup procedures, the frequency of backup the DB is same as content databases.
Database Name Description
WFResourceManagementDB Workflow Manager Resource Management Store
WFInstanceManagementDB Workflow Manager Instance Management Store
SbGatewayDatabase Service Bus Gateway Database
SBMessageContainer01 – n Service Bus Message Container Databases
  • Document the users/passwords used while configuring workflow manager.
  • Copy all the certificates generated during initial Workflow Manager Configuration and the certificate password and Important to save the thumbnail of the service bus certificate.

Notes:

  • Certificates will exist on local certificates in personal folder and full trusted certificates folder all of them need to be exported specially the service bus certificate.
  • To know service bus certificate run the command Get-SBFarm the returned result will contain the farm certificate thumbprint, check this thumbprint on the local machine certificates in the personal folder.
  • Export certificate with private key.
  • Keep track of outage date and time when it happens as it will be needed.
  • Document all ports used during initial configuration.
  • Get the symmetric key using this command and save it. “Get-SBNamespace -Name WorkflowDefaultNamespace”.
  • Save all scopes names specially the one used to register the workflow manager farm to do that run the getscopes.ps1 script

Restore Workflow Manager

  • Prepare a new machine to install workflow manager on the same domain as old machines
  • Use the same accounts when the workflow manager was configured originally.
  • Make sure that App Management service/service application running and subscription service too
  • Make sure to have user profile and user profile synchronization running and run full synchronization.
  • Install workflow manager on new machine but don’t configure it.
  • To install workflow manager install web platform installer and search for “workflow manager refresh 1”
  • Restore the backed up databases.
    • Only the following database should be restored.
    • WFResourceManagementDB
    • WFInstanceManagementDB
    • SbGatewayDatabase
    • SBMessageContainer* (all message container DBs)
      • Note: Do not restore the WFManagementDB and SbManagementDb databases as they will be recreated as part of the restore operation.
  • Restore any needed content DBs, web applications and site collections.
  • Restore the certificates exported during backup.
  • Open an elevated SharePoint PowerShell (Run as Administrator) window on the new machine.
  • Copy all the scripts and the wfm.config to a folder and navigate to that folder from the SharePoint PowerShell console.
  • Run restoreWFStep1 script (modify the parameters in the script as appropriate first).
  • Run restoreWFStep2 script (modify the parameters in the script as appropriate first).
  • For each container database, run the previous step after modifying the parameters. (optional if more than container database exists)
  • Run restoreWFStep3 (modify the parameters in the script as appropriate and put the thumbprint for the imported certificate).
  • Run restoreWFStep4 (modify the parameters in the script as appropriate first).
  • Set-SBNamespace –PrimarySymmetricKey  keyvalue  -Name WorkflowDefaultNamespace
  • Open new SharePoint PowerShell as Administrator.
  • Navigate to the folder containing scripts from the SharePoint PowerShell console.
  • Run the following commands
    • $filename = Resolve-Path .wfm.config
    • [System.AppDomain]::CurrentDomain.SetData(“APP_CONFIG_FILE”, $filename.Path)
  • Run restoreWFStep5 script (modify the parameters in the script as appropriate first).
  • Run restoreWFStep6 script (modify the parameters in the script as appropriate first).
  • Adjust DNS for workflow manager.
  • In IIS make sure to have the binding with the port for http for the workflow manager IIS site
  • You may need to register the workflow farm with the scope name used in the original farm
    • Register-SPWorkflowService -SPSite “http:/webapplication” -WorkflowHostUri “http://workfowsite:12291 ” -AllowOAuthHttp -Force -ScopeName “MyScope”
    • This command needs to run on the SharePoint Farm.(It is optional step if the farm didn’t see the workflow)
  • Run the following timer jobs from the central admin
  • Workflow Auto Cleanup
  • Notification Timer Job
  • Hold Processing and Reporting
  • Bulk workflow task processing
  • Refresh Trusted Security Token Services Metadata feed [Farm job – Daily]

Notes:

To add other workflow manager servers, just import the certificate and run restoreWFStep4 (after modifying the parameters) and then run restoreWFStep6 (after modifying the parameters).

There are other cases for restoration, in case if the application servers are not affected only the SQL server in this case the uninstall workflow manager from existing application server and then follow the above steps, once done you can uninstall workflow manager from other nodes and install workflow manager  and reinstall it  but don’t configure it just use the commands in script of restoreWFStep4  and restoreWFStep6

There is other case when the the application server is affected, in this case prepare a new machine and apply the above steps, then for any other node you can install workflow manager but don’t configure it just run restoreWFStep4  and restoreWFStep6 in the scripts to add those nodes.

Advertisements

Installing Workflow Manager Offline

Microsoft has introduced new Workflow engine and concept with SharePoint 2013 called Workflow Manager.

The SharePoint 2013 Workflow platform uses the new Workflow Manager service. Workflow Manager is built on top of Windows Workflow Foundation. Windows Workflow Foundation is part of the .NET Framework 4.5.

Workflow Manager is a separate download and must be configured to communicate with the SharePoint Server 2013 farm.

In several cases your environment is secured and not accessing the internet and you want to install the workflow manager so in the following steps I am going to explain how to do that so you can install Workflow Manager offline to server(s) not connected to the internet.

  • Download the web platform installer

http://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi and install it on a machine with internet access

  • Run the following commands as administrator from command prompt on the machine with internet access to download Service Bus, Workflow Client and Workflow Manager Refresh for offline

Webpicmd /offline /Products:ServiceBus /Path:E:ServiceBus

Webpicmd /offline /Products:WorkflowClient /Path:E:WorkflowClient

Webpicmd /offline /Products:WorkflowManagerRefresh /Path:E:WorkflowManagerRefresh

 

Note: modify E: with the path you would like to download to

  • On the machine with internet access, download the Cumulative Update for Service Bus 1.0 from:

http://www.microsoft.com/en-us/download/details.aspx?id=36794

  • Copy the downloaded file from Step 1, 2 and 3 to the server(s) where you will install the Workflow Manager.
  • On each server where you will install workflow manager run and install the following
  • Open command prompt as administrator and run the following:

WebpiCmd.exe /Install /Products:ServiceBus /XML:E:ServiceBusfeedslatestwebproductlist.xml

  • Manually install the file you downloaded from step 3
  • Open command prompt as administrator and run the following:

WebpiCmd.exe /Install /Products:WorkflowClient /XML:E:WorkflowClientfeedslatestwebproductlist.xml

  • Open command prompt as administrator and run the following:

WebpiCmd.exe /Install /Products:WorkflowManagerRefresh /XML:E:WorkflowManagerRefreshfeedslatestwebproductlist.xml

Note: modify E: with the path where files you copied from previous steps exist.

The next step is to configure the Workflow Manager Farm and connect it with SharePoint to do so check the following article from MSDN

https://msdn.microsoft.com/en-us/library/jj193510(v=azure.10).aspx

SharePoint 2013 Workflow Manager possible issues and fixes

1.Error:

Unable to properly communicate workflow service.

Resolution :

Re-installed workflow manager by removing FQDN(servername.domainname) with Service Bus 1.0 cumulative update 1. Do not use FQDN (fully qualified domain name).

Ex: SP2013DEV01.Contoso.com à SP2013DEV01SP2013DEV01

Reference:

For Install and Uninstall Workflow Manager

http://technet.microsoft.com/en-us/library/jj193448

2.Error :

Create designer WF for testing. When you trying to publishing the designer WF. It will throw below error.

Microsoft.Workflow.Client.InvalidRequestException: Scope ‘/SharePoint/default/fff19e1b-4a2b-42e5-a144-5341d052e82c/5c6c812e-59c7-439d-9d17-3fc9018dbfe1’ is not in an updatable state. Its current state is ‘Unregistered’. HTTP headers received from the server – ActivityId: d6ff3074-0680-4c56-b955-5d90ff33e6a9. NodeId: HFSP2013STG01. Scope: /SharePoint/default/fff19e1b-4a2b-42e5-a144-5341d052e82c/5c6c812e-59c7-439d-9d17-3fc9018dbfe1. Client ActivityId : 4c846a9c-ee4b-1004-2903-c9769a91c67b. –

Resolution :

Register-SPWorkflowService -SPSite “http:// SP2013DEV01/” -WorkflowHostUri “http:// SP2013DEV01/:12291/” -Force -ScopeName “SharePoint”

3.Error :

Go to workflow instance of that record and under the Running Workflows section. Click on your workflow name. You can see the “Workflow getting Suspended (Click on “i”  information icon)”

Resolution :

Register-SPWorkflowService -SPSite “http:// SP2013DEV01/” -WorkflowHostUri “http:// SP2013DEV01/:12291/” – AllowOAuthHttp -Force -ScopeName “SharePoint”

4.Error :

Go to workflow instance of that record and under the Running Workflows section. Click on your workflow name. You can see the “Workflow getting Automatically Cancelled. (Click on “i”  information icon)”

Exception details: System.ApplicationException: HTTP 401 {“x-ms-diagnostics”:[“3000006;reason=”Token contains invalid signature.”;category=”invalid_client””],”SPRequestGuid”:[“f880abe6-d546-7d6b-a43a-37ab0346cde5″],”request-id”:[“f880abe6-d546-7d6b-a43a-37ab0346cde5″],”X-FRAME-OPTIONS”:

Resolution :
Refresh “Trusted Security Token Services Metadata feed” Timer job.

5.Error : 

The Workflow absolutely working fine in development server and when we deploying the solution and activating the feature. It’s throwing below error.

System.InvalidOperationException: Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors: Cannot create unknown type ‘{wf://workflow.windows.net/$Activities}GetCurrentItemId’.

Root Cause Analysis:

In the workflow visual studio automatically referring the below DLL. This DLL will place automatically when you installed VS2012. Since we do not have Visual Studio in Staging its keep throwing the above error (which mentioned).

reference properties

reference properties

“Microsoft.SharePoint.DesignTime.Activities.dll”  and the physical path of this dll located in below path, where the Visual Studio related dll’s are placing and when installed Visual Studio.
C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEPublicAssembliesMicrosoft.SharePoint.DesignTime.Activities.dl

Solution :

Now, we have fixed this issue keeping above dll into inetpub/_app_bin folder and referring this in Workflow project. Then the same thing we are doing in Staging also. Then the workflow started working.