Monday, May 27, 2013

SharePoint 2013 Workflow Manager configuration (Server /client)

1.              Workflows in SharePoint 2013


Workflows in SharePoint 2013 allow you to model and automate business processes. These business processes can be as simple as a document approval process with a single approver (shown in below figure), as complex as customer-facing product catalog using web service calls and database support, or as formidable as virtually any structured business process, full of conditions, loops, user inputs, tasks, and custom actions.

A simple SharePoint workflow
powerful new foundation for SharePoint workflows. Build on Windows Workflow Foundation. Workflow Manager Client 1.0 provides advantages over previous versions that reflect the commitment of SharePoint to the model for apps for SharePoint and cloud-based computing.

1.              Workflow Manager 1.0

Workflow Manager 1.0 is a new server which introduces new capabilities for authoring, hosting and managing workflows. These workflows will run at high scale and density, and will support execution in a multi-tenant environment. The service builds on the successful programming model, runtime and activity library that was introduced with Windows Workflow Foundation (WF) in .NET Framework 4.

Workflow Manager 1.0 is used by SharePoint 2013 to run SharePoint workflows, and will be an inherent part of most Office 365 subscriptions.

High-level architecture of the workflow infrastructure

Obove image depicts a high-level view of the SharePoint 2013 workflow framework. Notice, first, how the new workflow infrastructure introduces Workflow Manager Client 1.0 as the new workflow execution host. Whereas in previous versions workflow execution was hosted in SharePoint itself, this has changed in SharePoint 2013. Workflow Manager Client 1.0 is external to SharePoint and communicates using common protocols over the Windows Azure service bus, mediated by OAuth. Notice that there is also an implementation of the SharePoint 2010 workflow host (that is, the Windows Workflow Foundation 3 engine) for backward compatibility.

Workflow Manager Client 1.0 is represented in SharePoint 2013 in the form of the Workflow Manager Client 1.0 Service Application Proxy. This component allows SharePoint to communicate and interact with the Workflow Manager Client 1.0 server. Server-to-server authentication is provided using OAuth.

SharePoint events for which a workflow is listening, like itemCreateditemUpdated, and so on, are routed to Workflow Manager Client 1.0 using the Windows Azure service bus. For the return trip, the platform uses the SharePoint Representational State Transfer (REST) API to call back into SharePoint.

There are also additions to the SharePoint workflow object model, called collectively the Workflow Services Manager, which allow you to manage and control your workflows and their execution. The primary zones of interaction for the services manager are deployment, messaging, instance control, and interoperability with SharePoint 2010 workflows.

Finally, there is the workflow authoring component. SharePoint Designer can now create and deploy both SharePoint 2010 and SharePoint 2013 workflows. Visual Studio 2012 not only provides a designer surface for creating declarative workflows, but it can also create apps for SharePoint and solutions that fully integrate Workflow Manager Client 1.0 functionality.

1.              Prerequisites for Workflow Manager 1.0 Installation


Web Platform Installer checks for these prerequisites before it installs Workflow, and it automatically installs any prerequisites that it does not find. You do not need to install any prerequisites separately.
·         .NET Framework 4 Platform Update 3 or .NET Framework 4.5
·         Service Bus 1.0
·         Workflow Client 1.0
·         PowerShell 3.0
The following additional requirements must be met before you can run Configuration Wizard to configure Workflow:
·         Instance of SQL Server 2008 R2 SP1, SQL Server Express 2008 R2 SP1, or SQL Server 2012.
·         TCP/IP connections or named pipes must be configured in SQL Server.
·         Windows Firewall must be enabled.
·         Ports 12290 and 12291 must be available.

The following topologies are supported:
·         SQL Server can be installed on the same physical machine with Workflow 1.0 and Service Bus, or on a different one.
·         The Service Bus databases can reside on multiple machines as well. All of them need not be created on a single database server.

For more information on system requirements for installing and configuring Workflow Manager 1.0 follow this MSDN article.

2.              Online Installation of Workflow Manager 1.0


1.            You can install Workflow Manager by clicking this installation link.
a)      If Web Platform Installer 4.5 (Web PI) is not installed on the computer, clicking the link initiates the installation for Web PI. After you accept the license terms and the installation of Web PI completes, the prerequisite page for Workflow Manager 1.0 starts.
b)      If Web PI 4.5 is already present on the computer, clicking the link starts the prerequisite installation page for Workflow Manager 1.0.
If the computer has an older version of Web PI, clicking on the installation link will start a prompt for upgrading Web PI. Accept it to continue with the installation.
               2.       The Prerequisites dialog appears with a list of prerequisite components that are not present on your computer but that Web PI downloads and installs, including third-party components for which you have not accepted licensing terms.
Check the components and click the I Accept button at the bottom of the dialog to accept the license terms. 

Click View license terms beneath any component to read the licensing terms for that component before you accept the terms.
Depending on the prerequisites that Web PI installs, you may need to reboot your machine, or your machine may reboot automatically. After the machine reboots run Configuration Wizard manually to configure the installation.

1.               Web PI downloads and installs any missing prerequisites, then installs Workflow Manager.
2.               When the missing prerequisites and Workflow Manager are installed you can startConfiguration Wizard. Click the Continue button to start the wizard.
Web PI starts Configuration Wizard. The following Web PI dialog indicates that the installation and configuration have completed successfully.
1.               Click Finish to end the installation process.

1.              Offline Installation of Workflow Manager 1.0


Workflow Manager 1.0 is installed using the Microsoft Web Platform Installer 4.5. If the target machine does not have internet access (for example for security reasons), then the online Web PI installation of Workflow Manager cannot be used, and the components must be installed offline. This section describes how to download the required components and perform an offline installation of Workflow Manager 1.0.

To download the files
1.      On a machine with internet access, download the Web Platform Installer v4 command line (WebPICMD.exe) and expand the files to a new folder.


Warning
If you have WebPI v3 or v4 installed, do not extract these files to the existing WebPI directories. Please extract the files to a new directory.
2.      Open an elevated command line prompt and navigate to the folder where WebPICMD.exe was extracted in the previous step and enter the following command.

webpicmd /offline /Products:WorkflowManager /Path:c:\WorkflowManagerFiles

The Path command line parameter specifies the location of the downloaded files. If the specified folder does not already exist it is created. In this example theC:\WorkflowManagerFiles path is used.

To copy the files to the target machine
Note
The steps in this procedure may be skipped if the steps in To download the files were performed on the target machine. If the files were downloaded on a different machine, then the steps in this procedure must be followed to copy the files along with WebPICmd.exe to the target machine.

Copy the folder and all subfolders and files from step 2 of To download the files to a folder on the target machine.
Note
It is not necessary to copy WebPICmd.exe to the target machine as it is included as part of the files downloaded in step 2 of To download the files.
1.      To install the files
2.      On the target machine, open an elevated command line prompt and navigate to thec:\WorkflowManagerFiles\bin folder. (If you used a different folder, replace C:\WorkflowManagerFiles with the name of the folder that you used.)
3.      Run the following command.
WebpiCmd.exe /Install /Products:WorkflowManager /XML:c:/WorkflowManagerFiles/feeds/shadow-webproductlist.xml
The XML command line parameter specifies the location of the downloaded files. Replace the first part of the path (in this example it is C:\WorkflowManagerFiles) with the folder name on your target machine.
Once the installation completes, Workflow Manager 1.0 can be configured by following the steps at Configuring Workflow Manager 1.0 using Configuration Wizard or Configuring Workflow Manager 1.0 using PowerShell.

2.              Configure Workflow Manager 1.0 Using Wizard


Warning
You can either configure Workflow Manager using Workflow Configuration Wizard or PowerShell. Using them interchangeably is not supported.

After Web PI/offline installer finishes installing Workflow Manager it automatically runs the Workflow Manager Configuration Wizard. You can also start Workflow Manager Configuration Wizard manually at any time. Use the following procedure:
·         Open the Start menu.
·         In All Programs, go to Workflow Manager 1.0. Click the Workflow Configuration shortcut to start Workflow Configuration Wizard.

The configuration adds your machine to a new or existing server cluster, known as a farm. If you decide to create a new farm, you can either choose to use the default settings or enter custom values for settings that identify and configure the farm you are creating. The Workflow Manager Configuration Wizard supports the following operations.

2.1.           Create a New Farm

Workflow Configuration Wizard creates a new farm and assigns the server on which you have installed Workflow Manager to the new farm. You are required to run this process only once per farm, before you add nodes to the farm.
You can create a farm using defaults for many of the required settings, or you can add additional customizations to the new farm by specifying values for those settings.
If an error occurs or you are forced to reboot during the farm creation, the farm management database that is created may be left in a corrupt state. In that case, when you try to join a farm the process may display an error that says that the machine you are trying to add to the farm is not a part of any farm. When you encounter such an error, you must drop the farm management database and recreate it before you can join any new nodes to the farm.
With Default Settings-:
When you create a new farm using the default configuration settings, both the Workflow Manager and Service Bus farms are created using the same settings. Use the following procedure to create a new farm and assign the Workflow Manager server to the farm using the default settings.
      1.     Select Configure Workflow Manager Farm with Default Settings (Recommended).New Farm Configuration page appears.
2.      In the SQL SERVER INSTANCE text box, the name of the SQL Server instance on the current computer appears by default. To specify a different SQL Server, type the complete name of the SQL Server instance that will host the databases for the farm. Refer to the SQL Server section in System Requirements (Workflow Manager 1.0) for understanding SQL Server requirements. To verify that the instance name you have entered points to a valid instance, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, a message will be displayed in the wizard.

By default, the wizard connects to the SQL server using Windows Authentication with the account of the current user. SQL Authentication can be set by using the advanced options. If your SQL server requires SSL connections, you can enable it using the advanced options.
3.      Under Configure Service Account, your user ID appears in the USER ID text box to identify the user account under which services run. To change the user ID for the user account, enter a new user ID in the USER ID text box. The user ID must be in the formatusername@domain-name or domain\user. Then enter the password for that user ID in the PASSWORD text box. The wizard validates the user ID and password combination and if it finds an error notifies you to re-enter the user ID and password. The same user credentials are used for Workflow Manager Services and Service Bus services.
4.      Under Certificate Generation Key, enter a key in the first text box, and then re-enter it one more time in the text box under CONFIRM CERTIFICATE GENERATION KEY to confirm the first key you entered. The wizard checks the keys to make sure that they match. If the keys do not match the wizard notifies you to re-enter the keys. Record the key for future use because you will need to provide it every time you add a new computer to this farm.
The configuration cmdlets use this key for generating certificates. You can specify the custom certificate with the custom settings option.
5.      Check Allow Workflow Management over HTTP on this computer if you want to allow HTTP access in addition to HTTPS access to the Workflow Manager endpoint. You must enable this option individually on each machine of the farm. 
Note
Enabling HTTP support is not recommended in a production environment.
6.      Check the Enable Firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager and Service Bus may fail to start.
7.      Select Next. The wizard displays the Summary screen, which lists the values that you have entered along with the default values for the remaining configuration options. The screen also displays the configuration options and values for the farm as a whole and for Workflow Manager individually.
The wizard will also validate if the configuration values are valid for this computer. With any error the wizard will display the error page and will not allow you to proceed further. You can either go back to change the configuration that is causing the error or, if possible, fix the error outside the wizard.
For some errors it may not be possible to continue with the default configuration. For example, if the default port used for Workflow Manager Management is blocked by some application it may not possible to get it unblocked. If it is not possible to continue with the default configuration you must create the new farm with custom settings.
Tip
If there are any errors that you fix outside the wizard, you can use the re-validate button to validate the configuration again.
Tip
If you want to configure using PowerShell, you can generate the script based on the current configuration on this page by clicking on Get PowerShell Commands link.
1.      Click the Apply button to approve the listed options, to create the new farm, and to add the server to the new farm. Click the Back button to return to the New Farm Configuration page and to change the entries you have made.
Use Custom Settings-:
When you create a new farm using the custom configuration settings, the new farm may contain both the Workflow Manager and Service Bus.
1.      Configure databases required for Workflow Manager.
Workflow Manager requires three databases. 
o    Farm management database that manages the farm configuration.
o    Instance manager database that contains information about each running and terminated instance of the currently running Workflow Manager.
o    Resource management database that manages the workflow artifacts in Workflow Manager.
You can specify the SQL Server Instance and database name for each of these databases. In the SQL SERVER INSTANCE text box, the name of the SQL Server instance on the current computer appears by default. To specify a different SQL Server, type the complete name of the SQL Server instance that will host the databases for the farm. The current user needs to have SysAdmin privilege on this SQL Server instance. Refer to the SQL Server section in System Requirements (Workflow Manager 1.0) for understanding SQL Server requirements.
By default, the wizard connects to the SQL server using Windows Authentication with the account of the current user. SQL Authentication can be set by using the advanced options. If your SQL server requires SSL connections, you can enable it using the advanced options.
To verify that the instance name you entered points to a valid instance and the specified database name exists, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, place the mouse cursor over the red X in the error message to see the reason for the connection failure.
Check Use the above SQL server instance and settings for all databases checkbox if you want to use the same SQL server instance and associated settings for all databases.
2.      Under Configure Service Account, your user ID appears in the USER ID text box to identify the user account under which services run. To change the user ID for the user account, enter a new user ID in the USER ID text box. The user ID must be in the formatusername@domain-name or domain\user. Then enter the password for that user ID in the PASSWORD text box. The wizard validates the user ID and password combination and if it finds an error notifies you to re-enter the user ID and password.
3.      Under Configure Certificate you can specify whether the wizard should generate certificates for you or take certificates specified by you. The wizard will generate the certificates by default. In this case you will have to specify a certificate generation key. Enter the key in the CERTIFICATE GENERATION KEY text box, and re-enter it in the CONFIRM CERTIFICATE GENERATION KEY text box. The wizard checks the keys to make sure they match and notifies you to re-enter them if they do not.
Record the key for future use because you will need to provide it every time you add a new computer to this Workflow Manager farm. 
If you clear the Auto-Generate checkbox, the wizard will allow you to specify two certificates. These certificates should already be installed on the Local Machine\Personal store. You will also need to install these certificates on all the computers in the farm. The following certificates are configured.
o    The Workflow Manager SSL certificate secures HTTPS communications between Workflow Manager and clients. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) to understand certificate requirements.
o    The Configure Workflow Outbound Signing Certificate option determines the certificate that Workflow Manager requires to secure communications between workflows. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) to understand certificate requirements.
o    The Encryption certificate is used for encrypting all of the Workflow connection strings stored in the Workflow Management database. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) for more information on certificate requirements.
4.      In Configure Port you can specify the ports on which Workflow Manager listens to management requests. You can specify the HTTPS and HTTP ports for this purpose. If you want to enable HTTP access, check Allow Workflow Management over HTTP on this computer. You must enable this option individually on each machine of the farm.
Note
Enabling HTTP support is not recommended in a production environment.
5.      Check the Enable Firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager and Service Bus may fail to start.
6.      In the text box under Configure Admin Group enter the name of the user group. This is the user group for which you want to grant access for all databases that you are adding to the farm and service configuration.

By default, the administrative group name is used. BUILTIN\Administrators appears by default. Every user in this group has administrative access to the databases that are part of the farm. If this group is local, ensure that the group also exists on all computers in the farm and on the SQL Server that you specified earlier.
Click the Next link. The wizard displays the Service Bus Configuration page.
The page displays configuration options for Service Bus. Each option has a default value already filled in.
1.      Service Bus requires you to configure three databases:
a.              The farm management database for managing the farm configuration.
b.              The gateway database that load-balances and manages incoming Service Bus requests.
c.              The message container database that where Service Bus keeps its message queues and topics.
You can specify SQL Server Instance and database name for each of these databases.

In the SQL SERVER INSTANCE text box, the name of the SQL Server instance on the current computer appears by default. To specify a different SQL Server, type the complete name of the SQL Server instance that will host the databases for the farm. The current user needs to have SysAdmin privilege on this SQL Server instance. Refer to the SQL Server section in 
System Requirements (Workflow Manager 1.0) for understanding SQL Server requirements.

To verify that the instance name you entered points to a valid instance and the specified database name exists, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, hover the cursor over the red X in the error message to see the reason for the connection failure.
2.      Under Configure Service Account, you can opt to use the same service account credentials as Workflow. The User ID of the current user appears in the USER ID text box to identify the user account under which Service Bus services will run. To change the user ID for the user account, enter a new user ID in the USER ID text box. The user ID must be in the format username@domain-name or domain\user. Then enter the password for that user ID in the PASSWORD text box. The wizard validates the user ID and password combination and if it finds an error notifies you to re-enter the user ID and password.
3.      Under Configure Certificate you can specify whether the wizard should generate certificates for you or take certificates specified by you. The wizard will generate the certificates by default. In this case you will have to specify a certificate generation key. If you had provided a certificate generation key for Workflow, you can reuse the same key by checking the Use the same certificate generation key provided for Workflow. Otherwise, enter the key in the CERTIFICATE GENERATION KEY text box, and re-enter it in the CONFIRM CERTIFICATE GENERATION KEY text box. The wizard checks the keys to make sure they match and notifies you to re-enter them if they do not. Record the key for future use because you will need to provide it every time you add a new computer to this Workflow Manager farm.

If you clear the Auto-Generate checkbox, the wizard will allow you to specify certificates required by Service Bus. 
The farm certificate secures HTTPS communications between Service Bus 1.0 and Workflow Manager. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) to understand certificate requirements.
4.      The options under Configure Ports determine the TCP ports that Service Bus uses to communicate with its clients and the range of ports that Service Bus nodes use to communicate with one another. Under TCP PORT and COMMUNICATION PORT RANGE enter a TCP port number in the text box. The HTTPS port is used for SSL communication with Service Bus. The Message Broker port is used for message broker port communications. For COMMNICATION PORT RANGE the port number you enter represents the first of six ports that nodes can use to communicate.
5.      Check the Enable Firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager and Service Bus may fail to start.
6.      In the text box under Configure Admin Group, enter the name of the user group to which you want to grant access for all databases that you are adding to the farm and service configuration. By default, the administrative group name is used. BUILTIN\Administrators appears by default.
7.      Select Next. The wizard displays the Summary page that lists the values that you have entered along with the default values for the remaining configuration options. The page displays the configuration options and values for the farm as a whole and for Workflow Manager.

The wizard validates the configuration values for this computer. If there is any error, the wizard displays the page with an error and does not allow you to proceed further. You can either go back to change the configuration that is causing the error or, if possible, fix the error outside the wizard.
Tip
If there are any errors that you can fix outside the wizard, you can use the re-validate button to validate the configuration again.
Tip
If you want to configure using PowerShell, you can generate the script based on current configuration on this page by clicking on PowerShell Commands link.
8.      Click the Apply button to add the server to the new farm, or Click the Back link to return to the Farm Configuration page and change the entries you made.

The wizard displays the Configuration progress page that shows the installation progress and the details of the current installation operation in the Details list. If any errors occur during the installation, you can click the View log link to see which installation step caused the error.

1.1.           Joining an existing farm

We can increase size of the farm using the Join Farm option in the configuration wizard.
Use the following procedure to join an existing farm.
When the Workflow Manager Configuration Wizard page appears, click Join an Existing Workflow Farm. The Join Farm page appears.
1.       
2.      Under Provide Workflow Farm Management Database type the complete name of the SQL Server farm management database instance for the existing Workflow Manager farm in the SQL SERVER INSTANCE text box. If the farm management database has a custom database name, also type that database name in the DATABASE NAME text box.
By default, the wizard connects to the SQL server using Windows Authentication, using the account of the current user. SQL Authentication can be used by setting the advanced options. If your SQL server requires SSL connections, you can enable it using the advanced options.
To verify that the instance name you entered points to a valid instance, and that the specified database name exists, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, place the mouse cursor over the red X in the error message to see the reason for the connection failure.

Check Use the above SQL server instance and settings for all databases checkbox if you want to use the same SQL server instance and associated settings for all databases.
3.      Under Provide Service Bus Farm Management Database type the complete name of the SQL Server farm management database instance for the existing Service Bus farm in the SQL SERVER INSTANCE text box. If you had checked Use the above SQL server instance and settings for all databases, this field will be read-only. If the farm management database has a custom database name, also type that database name in the DATABASE NAME text box.
To verify that the instance name you entered points to the correct database, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, hover the cursor over the red X in the error message to see the reason for the connection failure.
4.      Click the Next link to retrieve the configuration provided during farm creation. Join Workflow Farm page is displayed.
5.      Under Service Account Password type the password for that user account in the PASSWORD text box. The user ID must be the same as the user ID that you specified when you created the Workflow Manager farm.
The wizard validates the user ID/password combination and notifies you to re-enter them if it finds an error.
6.      If you specified auto generation of the certificate, you must also provide the certificate generation key. Under Provide Certificate Generation Key, enter the key used to auto generate certificates for the Workflow Manager farm in the text box. This key must be the same as the farm key that you specified when you created the Workflow Manager farm.
7.      Check Allow Workflow Management over HTTP on this computer if you want to allow HTTP access in addition to HTTPS access to the Workflow Manager Management endpoint for this computer.
Warning
Enabling HTTP support is not recommended in a production environment.
8.      Check the Enable firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager may fail to start.
9.      Click the Next link to retrieve the configuration provided during farm creation. Join Service Bus Farm page is displayed.
10.  Under Service Account Password, type the password for that user account in the PASSWORD text box. The user ID must be the same as the user ID that you specified when you created the Service Bus farm.
The wizard validates the user ID/password combination and notifies you to re-enter them if it finds an error.
If you had used the same service account for Workflow Manager and Service Bus while creating the farm, you can copy the password by checking the Use the same service account credentials provided for workflow checkbox.
If you specified auto generation of certificate, you must also provide certificate generation key. Under Provide Certificate Generation Key, enter the key used to auto generate certificates for the Service Bus farm in the text box. This key must be the same as the farm key that you specified when you created the Service Bus farm. If you had used the same certification generation key for Workflow Manager and Service Bus while creating the farm, you can copy the key here by checking the Use the same certification generation key provided for workflow checkbox.
11.  Check the Enable firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager may fail to start.
12.  Click the Next link to view the summary page that contains the farm configuration that will be applied on this computer. A message is displayed on the summary page if there is any error, such as a missing certificate or a blocked port.
Tip
If you want to configure using PowerShell, you can generate the script based on current configuration on this page by clicking on the PowerShell Commands link.

13.  Click the Apply link to approve the listed options, to join the farm, and to verify that any custom certificates specified during farm creation are installed on this computer.


Tip
Configuration Wizard uses ‘WorkflowDefaultNamespace’ as the Service Bus service namespace for use by Workflow Manager. When joining a farm, Configuration Wizard will create this service namespace if it does not exist.

1.1.           Leaving the Farm

Workflow Manager Configuration Wizard provides a way for you to remove a server on which you have installed Workflow Manager from a farm.
Use the following procedure to leave a farm.
When the Workflow Manager Configuration Wizard page appears, click Leave Farm. The Leave Farm page appears.
1.       
2.      Under Farm Management Database the name of the SQL Server farm management database instance for both Workflow Manager and Service Bus farms appears. You do not need to provide input at this point.
3.      Click the Apply link to approve the listed options, specify the farm, and to remove the server from the farm, or click the Back link to return to the welcome screen. 
The wizard displays the Configuration progress screen, which shows the progress of the deletion operation and the details of the current deletion operation in the Details list. If any errors occur during installation, you can click the View log link to see which installation step caused the error.
When you leave a farm, the uninstaller leaves any certificates that you installed on the machine. If you want to remove those certificates, you must do so manually.
Tip
The farm management database instance and name come from the registry. They are removed and services cleaned up from the computer even if the connection with SQL Server is down. To clean up the entry from SQL Server, you should use the Remove-WFHost and Remove-SBHost cmdlets as described in section Configuring Workflow Manager 1.0 using PowerShell.
Removing a server from a farm is essential when you need to rename a machine or to reduce a farm to a single machine.
To rename a machine that belongs to a farm:
1.      Remove the machine from the farm.
2.      Rename the server
3.      Add the computer back to the farm as described in Joining an Existing Farm.
To reduce the farm to a single computer farm:
1.      Remove all the computers from the farm.
2.      Add the computer you want to be part of the farm.
Note
When reducing the farm to a single computer, it is important to remove all of the computers from the farm, and add the single computer back.

1.              Configure Workflow Manager 1.0 using PowerShell


To run PowerShell manually and enter configuration cmdlets:
1.              Open the Start menu.
2.              In All Programs, go to Workflow Manager 1.0. Then click the Workflow PowerShellshortcut to RunAs administrator PowerShell console.

Below PowerShell script is the modified script originally generated by configuration wizard. The Script reads configuration values from xml file to perform the configuration. The script uses auto-generate key for certificate. Also the database name are hard-coded in the script, but you can add prefixes (like Dev, Test, QA, Prod) to the database from xml file. The script also configure App Management Service, if the service is not already created.

#Get current user full login name
$CurrentUserLoginName=[Environment]::UserName +
'@' + [Environment]::UserDomainName;
#Get current server fully qualified domain name
$HostFQDN=
"$env:computername.$env:userdnsdomain";

#Load SharePoint Snapin
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ){ 
    Add-PsSnapin Microsoft.SharePoint.PowerShell
}

#Get DB Connection String
function GetDBConnectionString([string]$connectionStringFormat, [string]$dbPrefix, [string]$dbName){
   
if($dbPrefix -ne ""){
        $dbFullName=$(GetDBName $dbPrefix $dbName);
       
return [string]::Format($connectionStringFormat,$dbFullName);
        }
   
else {
       
return $dbName;
    }
}

#Add Dev, Test etc. environment prefix, if needed
function GetDBName([string]$dbPrefix,[string]$dbName){
   
if(($dbPrefix) -and ($dbPrefix -ne "")){
       
return $dbPrefix + "_" + $dbName;
    }
   
return $dbName;
}

#Get current Script directory
function Get-ScriptDirectory
{
  $Invocation = (Get-Variable MyInvocation -Scope 1).Value
  Split-Path $Invocation.MyCommand.Path
}

function ConfigureWFManager([string]$settingsFile){
    [xml]$wfsettings = Get-Content $settingsFile
    $settings=$wfsettings.Settings;
    $SharePointSiteUrl=$settings.SiteUrl;
    $dbPrefix=$settings.DBPrefix;
    $CertificateKey=$settings.CertificationKey;
    $databaseServer=$settings.DBServer;
    $ConnectionStringFormat=
"Data Source=$databaseServer;Initial Catalog={0};Integrated Security=True;Encrypt=False";
    $RunAsAccount=$settings.WFManagerRunAsUser;
    $RunAsPasswordPlain=$settings.WFManagerRunAsPassword
    $WorkflowNamespace=$settings.WorkflowNamespace;
   
if(ShouldIProvision($settings.AppManagementService))
    {
        ProvisionAppManagementService($settings);
    }

   
# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.
   
# Create new Service Bus Farm
    $SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String $CertificateKey -Verbose;

    New-SBFarm -SBFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'SBManagementDB')  -InternalPortRangeStart 9000 -TcpPort 9354 -MessageBrokerPort 9356 -RunAsAccount $RunAsAccount -AdminGroup 'BUILTIN\Administrators' -GatewayDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBGatewayDB') -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -MessageContainerDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBMessageContainerDB') -Verbose;

   
# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.

   
# Create new Workflow Farm
    $WFCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String $CertificateKey -Verbose;


    New-WFFarm -WFFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'WFManagementDB') -RunAsAccount $RunAsAccount -AdminGroup 'BUILTIN\Administrators' -HttpsPort 12290 -HttpPort 12291 -InstanceDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFInstanceManagementDB') -ResourceDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFResourceManagementDB') -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

   
# Add Service Bus Host
    $SBRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String $RunAsPasswordPlain -Verbose;


    Add-SBHost -SBFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'SBManagementDB') -RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -Verbose;

    Try
    {
       
# Create new Servie Bus Namespace
        New-SBNamespace -Name $WorkflowNamespace -AddressingScheme
'Path' -ManageUsers $RunAsAccount,$CurrentUserLoginName -Verbose;

        Start-Sleep -s 90
    }
    Catch [system.InvalidOperationException]
    {
    }

   
# Get Service Bus Client Configuration
    $SBClientConfiguration = Get-SBClientConfiguration -Namespaces $WorkflowNamespace -Verbose;

   
# Add Workflow Host
    $WFRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String $RunAsPasswordPlain -Verbose;


    Add-WFHost -WFFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'WFManagementDB') -RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration $SBClientConfiguration -EnableHttpPort  -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

    Write-Host
"Registering workflow host (HTTP) to site: $SharePointSiteUrl";
    Register-SPWorkflowService –SPSite $SharePointSiteUrl –WorkflowHostUri $(
"http://$HostFQDN" + ":12291") –AllowOAuthHttp
}

function ProvisionAppManagementService([System.Xml.XmlNode] $settings){

    $appManagementServices=Get-SPServiceApplication | Where-Object { $_.GetType().ToString()
-eq "Microsoft.SharePoint.AppManagement.AppManagementServiceApplication"}
     If($appManagementServices
-ne $null)
     {
         Write-Host
"An App Managemetn service is already running. Returning.." -ForegroundColor Yellow
       
return;
     }   
   
    Write-Host
"Provisioning App Management Service";
    $appManagementService=$settings.AppManagementService;
    $appPool=$(GetAppPool $appManagementService)
    $dbName=$(GetDBName $settings.DBPrefix $appManagementService.DBName);
    $appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPool -Name $appManagementService.Name -DatabaseName $dbName
    New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
}

function GetAppPool([System.Xml.XmlNode] $appManagementService){
    $pool = Get-SPServiceApplicationPool -Identity $AppManagementService.AppPoolName -ErrorVariable err -ErrorAction SilentlyContinue
    If ($err) {
       
# The application pool does not exist so create.
        Write-Host -ForegroundColor White
" - Getting $($appManagementService.ManagedAccountUserName) account for application pool..."
        $managedAccount = (Get-SPManagedAccount -Identity $appManagementService.ManagedAccountUserName -ErrorVariable err -ErrorAction SilentlyContinue)
        If ($err) {
            If (($appManagementService.ManagedAccountPassword
-ne "") -and ($appManagementService.ManagedAccountPassword -ne $null))
            {
                $appPoolConfigPWD = (ConvertTo-SecureString $appManagementService.ManagedAccountPassword -AsPlainText -force)
                $accountCred = New-Object System.Management.Automation.PsCredential $appManagementService.ManagedAccountUserName,$appPoolConfigPWD
            }
            Else
            {
                $accountCred = Get-Credential $appManagementService.ManagedAccountUserName
            }
            $managedAccount = New-SPManagedAccount -Credential $accountCred
        }
        Write-Host -ForegroundColor White
" - Creating applicatoin pool $($appManagementService.AppPoolName)..."
        $pool = New-SPServiceApplicationPool -Name $appManagementService.AppPoolName -Account $managedAccount
    }
   
return $pool;
}

Function ShouldIProvision([System.Xml.XmlNode] $node)
{
    If (!$node) {Return $false}
# In case the node doesn't exist in the XML file
   
# Allow for comma- or space-delimited list of server names in Provision or Start attribute
    If ($node.GetAttribute(
"Provision")) {$v = $node.GetAttribute("Provision").Replace(","," ")}
    ElseIf ($node.GetAttribute(
"Start")) {$v = $node.GetAttribute("Start").Replace(","," ")}
    ElseIf ($node.GetAttribute(
"Install")) {$v = $node.GetAttribute("Install").Replace(","," ")}
    If ($v
-eq $true) { Return $true; }
    Return $false;
}

Write-Host
"Configuring WF Manager"
$location=Get-ScriptDirectory
ConfigureWFManager
"$location\Dev_WFFarmSettings.xml"

1.1.           XML file for Configuration Script


The following XML file provides the input settings for the above PowerShell script (named as Dev_WFFarmSettings.xml in the above PowerShell script)
<Settings>
  <SiteUrl>http://siteulr</SiteUrl>
 
  <!--Delete DBPrefix tag, if you don't want any prefix-->
  <DBPrefix>Dev_</DBPrefix>
 
  <!--Key used to generate certificates-->
  <CertificationKey>DevCertificationKey</CertificationKey>
 
  <!--Database server name, database names are hardcoded in powershell-->
  <DBServer>Dev_SQLServer</DBServer>
 
  <!--Format should be USERNAME@DOMAIN-->
  <WFManagerRunAsUser>user@domain</WFManagerRunAsUser>
  <WFManagerRunAsPassword>Password</WFManagerRunAsPassword>

  <!--dot (.) not allowed-->
  <WorkflowNamespace>Dev_WorkflowNamespace</WorkflowNamespace>
 
  <!--To work with workflow, app management service need to be provisioned-->
  <AppManagementService Provision="true">
    <Name>App Management Service Application</Name>
    <DBName>AppManagementServiceDB</DBName>
    <!--If managed account already exists with the same name, the existing one will be used-->
    <ManagedAccountUserName></ManagedAccountUserName>
    <ManagedAccountPassword></ManagedAccountPassword>
    <AppPoolName>App Management Service App Pool</AppPoolName>
  </AppManagementService>
</Settings>

For configuring individual components of Workflow Manager 1.0 using PowerShell please refer to this MSDN Article.

2.              Workflow Manager Client 1.0 installation


Workflow Manager Client 1.0 contains core assemblies including activities and client APIs for Workflow Manager 1.0 and Workflow Manager Tools 1.0 for Visual Studio 2012. Workflow Manager Client must be installed on machines that run Workflow Manager Client applications, and on machines that are used to develop Workflow Manager Applications.
Note
Workflow Manager Client 1.0 is installed as part of the Workflow Manager 1.0 setup. If Workflow Manager applications are developed or run on a machine where Workflow Manager is installed, then Workflow Manager Client does not need to be re-installed.

Workflow Manager Client 1.0 is installed using the Web Platform Installer. Click the following link to install Workflow Manager Client.
·                 Workflow Manager Client 1.0 installation
·                 Clicking on the above link will launch web installer
·         Click on the Install button as show below...
·         Accept the agreement.

1.              Connecting Workflow Manager 1.0 with SharePoint Server 2013


Once Workflow Manager 1.0 (Server) has been installed we need to connect it to SharePoint Server 2013.
Note-:
If workflow is installed on a separate server, which is not part of the sharepoint farm, you need to download and install the “workflow manager client” on the sharepoint server which you are configuring to use workflow.
Workflow Manager Client 1.0 can be downloaded from this link.

Follow the steps below to connect Workflow Manager 1.0 to SharePoint Server 2013…

1.1.           Getting Workflow Manager Ports

To find out HTTP and HTTPS ports the Workflow has been installed to. Open to the IIS manager (StartàRunàInetmgr), open Workflow Management site, and look at the bindings:
To obtain ports using PowerShell cmdlets, open the Workflow PowerShell console, and execute the following commands (for HTTP and HTTPS ports)...

Get-WFFarm | ft HttpPort
Get-WFFarm | ft HttpsPort

1.1.           Connect to SharePoint

Post obtaining the workflow ports, we need to connect it to SharePoint. Follow the steps below….

·         Open the SharePoint Management Shell (PowerShell) console.
·         Depending on if we want to use HTTP, or HTTPS-execute the following command...
Register-SPWorkflowService –SPSite "http://server/sitecollection" –WorkflowHostUri "http://WorkflowHost:PORT" –AllowOAuthHttp

·         Replace the SPSite, WorkflowHostUri and PORT with appropriate values.
·         SPSite is your site collection where you want to use Workflow.
·          WorkflowHost is the server where you have installed the Workflow.
·         PORT is the port number, determined in the previous step, depending if we want to use HTTP or HTTPS.
·         Above command takes some time to create the connection. It’s a silent command, we will not see any progress indicator, or status message that the connection has been successful.

1.2.           Verifying the connection

To verify that command executed in above section has created the connection, follow the steps below…

·          go to the Central Administration, Service Applications, and look for the “Workflow Service Application Proxy”

·         It should be started, and when you click on it, you should get the Workflow Service status.












4 comments:

  1. Great article, thank you!

    ReplyDelete
  2. Thanks for clear conception about Workflow Manager 1.0! I have also gotten better Workflow system from inforouter !

    ReplyDelete
  3. Sharepoint- Charul Bhargava: Sharepoint 2013 Workflow Manager Configuration (Server /Client) >>>>> Download Now

    >>>>> Download Full

    Sharepoint- Charul Bhargava: Sharepoint 2013 Workflow Manager Configuration (Server /Client) >>>>> Download LINK

    >>>>> Download Now

    Sharepoint- Charul Bhargava: Sharepoint 2013 Workflow Manager Configuration (Server /Client) >>>>> Download Full

    >>>>> Download LINK xj

    ReplyDelete