Great news – Jurgen
Willis and his team have worked hard to bring Microsoft’s
first V1.0 WF Workflow Hosting Manager
.

It  runs both as part of Windows Server and within Azure VMs also. It also is
used by the SharePoint team in 2013, so learn it once and you’ll get great mileage
out of it.
(I’m yet to put it through serious paces)

Some links to help you out

What
is it?

WF
Mgr 1.0 – Code Samples

 

The following main areas for WF improvements in .NET 4.5: (great MSDN
magazine article
)

  1. Workflow Designer enhancements

  2. C# expressions

  3. Contract-first authoring of WCF Workflow Services

  4. Workflow versioning

  5. Dynamic update

  6. Partial trust

  7. Performance enhancements

Specifically for WorkflowManager there’s integration with:

1. Windows Azure Service Bus.

So all in all a major improvement and we’ve now got somewhere serious to host our
WF Services. If you’ve ever gone through the process of creating your own WF host,
you’ll appreciate it’s not a trivial task especially if you want some deeper functionality
such as restartability and fault tolerance.

but. if you want to kick off a quick WF to be part of an install script, evaluate
an Excel spreadsheet and set results, then hosting within the app, spreadsheet is
fine.

Let’s go through installation:

Download from here

Workflow_Manager_BPA.msi = Best Practices Analyser.

WorfklowClient = Client APIs, install on machines that want to communicate to WF Manager.

WorkflowManager = the Server/Service Component.

WorkflowTools = VS2012 plugin tools – project types etc.

And we’ll grab the 4 or you can you the Web Platform Installer

 

The Workflow Client should install fine on it’s own (mine didn’t
as I had to remove some of the beta bits that were previously installed).

Installing the Workflow Manager – create a farm, I went for a Custom
Setting install
below, just to show you the options.

As you scroll down on this page, you’ll notice a HTTP Port – check
the check box to enable HTTP communications to the Workflow Manager.
This just makes it easier if we need to debug anything across the wire.

Select NEXT or the cool little Arrow->

On Prem Service Bus is rolled into this install now – accepting defaults.

Plugin your Service Accounts and passphrase (for Farm membership and an encryption
seed).

Click Next -> to reveal.

As with the latest set of MS Products a cool cool feature is the ’Get PowerShell
Commands’
so you can see the script behind your UI choices (VMM manager,
SCCM 2012 has all this right through). BTW – passwords don’t get exported in the script,
you’ll need to add.

Script Sample:

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

# Create new SB Farm
$SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force 
-String ‘***** Replace with Service Bus Certificate Auto-generation key ******’ -Verbose;


New-SBFarm -SBFarmDBConnectionString ‘Data
Source=BTS2012DEV;Initial Catalog=SbManagementDB;Integrated Security=True;Encrypt=False’
-InternalPortRangeStart 9000 -TcpPort 9354 -MessageBrokerPort 9356 -RunAsAccount ‘administrator’
-AdminGroup ‘BUILTIN\Administrators’ -GatewayDBConnectionString ‘Data Source=BTS2012DEV;Initial
Catalog=SbGatewayDatabase;Integrated Security=True;Encrypt=False’ -CertificateAutoGenerationKey
$SBCertificateAutoGenerationKey -MessageContainerDBConnectionString ‘Data Source=BTS2012DEV;Initial
Catalog=SBMessageContainer01;Integrated Security=True;Encrypt=False’ -Verbose;

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

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


New-WFFarm -WFFarmDBConnectionString ‘Data
Source=BTS2012DEV;Initial Catalog=BreezeWFManagementDB;Integrated Security=True;Encrypt=False’
-RunAsAccount ‘administrator’ -AdminGroup ‘BUILTIN\Administrators’ -HttpsPort 12290
-HttpPort 12291 -InstanceDBConnectionString ‘Data Source=BTS2012DEV;Initial Catalog=WFInstanceManagementDB;Integrated
Security=True;Encrypt=False’ -ResourceDBConnectionString ‘Data Source=BTS2012DEV;Initial
Catalog=WFResourceManagementDB;Integrated Security=True;Encrypt=False’ -CertificateAutoGenerationKey
$WFCertAutoGenerationKey -Verbose;

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


Add-SBHost -SBFarmDBConnectionString ‘Data
Source=BTS2012DEV;Initial Catalog=SbManagementDB;Integrated Security=True;Encrypt=False’
-RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey
$SBCertificateAutoGenerationKey -Verbose;

Try
{
    # Create new SB Namespace
    New-SBNamespace -Name ‘WorkflowDefaultNamespace’ -AddressingScheme
‘Path’ -ManageUsers ‘administrator’,’mickb’ -Verbose;

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

# Get SB Client Configuration
$SBClientConfiguration = Get-SBClientConfiguration -Namespaces ‘WorkflowDefaultNamespace’
-Verbose;

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


Add-WFHost -WFFarmDBConnectionString ‘Data
Source=BTS2012DEV;Initial Catalog=BreezeWFManagementDB;Integrated Security=True;Encrypt=False’
-RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration
$SBClientConfiguration -EnableHttpPort  -CertificateAutoGenerationKey $WFCertAutoGenerationKey
-Verbose;

 

Upon completion you should see a new IIS Site. with the ’management ports’ of in
my case HTTPS

 


Let’s Play

Go and grab the samples and have a play – make sure you run the samples as the user
you’ve nominated as ’Admin’ during the setup – for now.

Blog Post by: Mick Badran