Configuring The Service Bus Workflow Farm

This post is the fifth part related to currently named Windows Azure Workflow 1.0. I describe how to configure the Workflow Host farm.You can find the whole series also in the developers.de blog.

If you choose to create the farm, the configuration wizard will create three required databases:

Management Database
Resource Management Database
Instance Management Database

At this step you don’t have to change anything.

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_64F64C88.png

Then enter credentials of the user who will run the hosting processes.
As a certificate generation key enter some typical password and remember it!!!

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_76D2E055.png

After all configure required TCP and HTPP management ports. I would recommend to leave them at default.

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_369CC6DB.png

In the next step Service Bus farm settings are being configured. First of all the following databases will be created:

-Farm Management Database
-Gateway Database
-Message Container Database

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_0B582FD4.png

Then like in previous step service account. It is good to know that the wizard will automatically check if the user exists after you have entered the user name.
Also enter the password for certificate generation key. This can be a different one  than that in the case of Workflow Host.

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_4B221659.png

At the end you will have to enter TCP and HTTP port of the Service Bus server and the admin group name.

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_2F11576E.png

Before the farm is configured you will get a summary:

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_1CC890AC.png http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_2EA52479.png

You are finished if you see following:

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_55733AB9.png

How to do all this with PowerShell?

Following script is exactly executed by Wizard:

# To be run in Workflow PowerShell Console which has both Workflow and Service Bus installed.

# Create new SB Farm
$SBCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText -Force -String '***** Replace with Service Bus Certificate Auto-generation key******';

New-SBFarm -FarmMgmtDBConnectionString 'Data Source=HOSTInitial Catalog=SbManagementDB;Integrated Security=True' -PortRangeStart 9000 -TcpPort 9354 -RunAsName <'appfabricserviceuser@DOMAIN-AdminGroup> 'BUILTIN\Administrators' -GatewayDBConnectionString 'Data Source=HOST;Initial Catalog=SbGatewayDatabase;Integrated Security=True' -CertAutoGenerationKey $SBCertAutoGenerationKey -ContainerDBConnectionString 'Data Source=Auxo.DAENET.LAN;Initial Catalog=SBMessageContainer01;Integrated Security=True';

# To be run in Workflow PowerShell Console which has both Workflow and Service Bus installed.

# Create new WF Farm
$WFCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText -Force -String '***** Replace with Workflow Certificate Auto-generation key******';

New-WFFarm -FarmMgmtDBConnectionString 'Data Source=HOST;Initial Catalog=WFManagementDB;Integrated Security=True' -RunAsName <'appfabricserviceuser@DOMAIN'> -AdminGroup 'BUILTIN\Administrators' -HttpsPort 12290 -HttpPort 12291 -InstanceMgmtDBConnectionString 'Data Source=HOST;Initial Catalog=WFInstanceManagementDB;Integrated Security=True' -ResourceMgmtDBConnectionString 'Data Source=HOST;Initial Catalog=WFResourceManagementDB;Integrated Security=True' -CertAutoGenerationKey $WFCertAutoGenerationKey;

# Add SB Host
$SBRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String '***** Replace with RunAs Password for Service Bus ******';

Add-SBHost -FarmMgmtDBConnectionString 'Data Source=Auxo.DAENET.LAN;Initial Catalog=SbManagementDB;Integrated Security=True' -RunAsPassword $SBRunAsPassword -CertAutoGenerationKey $SBCertAutoGenerationKey;

Try
{
# Create new SB Namespace
New-SBNamespace -Name 'WorkflowDefaultNamespace' -AddressingScheme 'Path' -ManageUsers <'appfabricserviceuser@HOST','svcuser@DOMAIN'>;

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

# Get SB Client Configuration
$SBClientConfiguration = Get-sbclientConfiguration -Namespaces 'WorkflowDefaultNamespace';

# Add WF Host
$WFRunAsPassword = ConvertTo-SecureString -AsPlainText -Force -String '***** Replace with RunAs Password for Workflow ******';

Add-WFHost -FarmMgmtDBConnectionString 'Data Source=HOST;Initial Catalog=WFManagementDB;Integrated Security=True' -RunAsPassword $WFRunAsPassword -SBClientConfiguration $SBClientConfiguration -EnableHttpPort -CertAutoGenerationKey $WFCertAutoGenerationKey;

How to join an existing Farm?

Joining an existing farm is more or less a trivial operation, at least from the point of view of configuration. You have to provide database host name, credentials and generation keys for the Workflow Host and Service Bus.

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_7C4150F9.png http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_0A1396F5.png

Note that the joining process does not create databases. Instead, it joins the node to farm described by the set of existing databases.

What if something goes wrong?

During creation of the farm some things can go wrong. Here is one example which shows how my configuration wizard failed to add the host to the farm.

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_02F45A7D.png
When something similar happens, it can be that installation state remains inconsistent. Assuming the databases have been created, which is probably the case, you can join the farm as described in the previous topic.
If this does not work, start configuration wizard again

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_4DE7CB4C.png

and this time leave the farm:

http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_09A76400.png

After that I also stopped all services:
http://developers.de/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/damir_5F00_dobric/image_5F00_thumb_5F00_549AD4CF.png

and deleted all created databases in SQL Management Studio. After that you can start a fresh new configuration by selecting Create New Farm.