Troubleshooting Windows Azure Workflow 1.0 Beta Installation (401 Unauthorized)

SharePoint 2013 has brought as a completely new Workflow engine, currently known as mainly as Windows Azure Workflow in version 1.0 Beta, but sometimes also known only as Workflow 1.0 Beta.

It has a very convenient installation method, through Web Platform Installer + the Configuration Wizard which runs immediately afterwards. And, if you take a default settings, there is not much you need to configure yourself, basically only the database server and used service account.

wav02

And in most cases, it is fine, unless you get the….

wav01

 

[Error] [11.09.2012 11:54:11]: System.Management.Automation.CmdletInvocationException: Could not successfully create management Service Bus entity 'WF_Management/WFTOPIC' with multiple retries within timespan of 00:02:06.0538369. ---> System.TimeoutException: Could not successfully create management Service Bus entity 'WF_Management/WFTOPIC' with multiple retries within timespan of 00:02:06.0538369. ---> System.UnauthorizedAccessException: The remote server returned an error: (401) Unauthorized. Authorization failed for specified action: Manage..TrackingId:6d55e243-1c20-4c9b-a224-365ddffe39db,TimeStamp:9/11/2012 9:54:11 AM ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at Microsoft.ServiceBus.Messaging.ServiceBusResourceOperations.CreateOrUpdateAsyncResult`1.EndGetResponse(CreateOrUpdateAsyncResult`1 thisPtr, IAsyncResult ar)
   at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result)
   --- End of inner exception stack trace ---

Yes, 401, unauthorized.

Now, if you have clicked the ‘Get PowersShell commands” in the configuration wizard screen, you might notice that the usernames, used for the service accounts, have the domains stripped, even you have entered it properly in the configuration wizard.

For example, your user@domain.int has become user@domain. Which than causes the 401 error and crash on the last two configuration wizard operations.

So the workaround is:

1. Run the wizard again and leave the farm.

wav06

2. Open SQL Server Manager and delete all ServiceBus and Workflow related databases – they start with Sb and WF prefixes.

wav03

3. Start the wizard again, fill up everything, and click the “Get PowerShell Commands” link, just to get the correct PowerShell commands, copy and paste them into Notepad, or any other editor of your choice.

Double-check the service account names, AND SET THE PASSWORDS AGAIN (they are masked in the PowerShell file).

My PowerShell file looked like (change accounts, passwords, and ports):

# 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 'PASSWORD';

New-SBFarm -FarmMgmtDBConnectionString 'Data Source=sp2013.DOMAIN.int;Initial Catalog=SbManagementDB;Integrated Security=True' -PortRangeStart 9000 -TcpPort 9354 -RunAsName 'sp_content@DOMAIN.int' -AdminGroup 'BUILTINAdministrators' -GatewayDBConnectionString 'Data Source=sp2013.DOMAIN.int;Initial Catalog=SbGatewayDatabase;Integrated Security=True' -CertAutoGenerationKey $SBCertAutoGenerationKey -ContainerDBConnectionString 'Data Source=sp2013.DOMAIN.int;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 'PASSWORD';

New-WFFarm -FarmMgmtDBConnectionString 'Data Source=sp2013.DOMAIN.int;Initial Catalog=WFManagementDB;Integrated Security=True' -RunAsName 'sp_content@DOMAIN.int' -AdminGroup 'BUILTINAdministrators' -HttpsPort 12290 -HttpPort 12291 -InstanceMgmtDBConnectionString 'Data Source=sp2013.DOMAIN.int;Initial Catalog=WFInstanceManagementDB;Integrated Security=True' -ResourceMgmtDBConnectionString 'Data Source=sp2013.DOMAIN.int;Initial Catalog=WFResourceManagementDB;Integrated Security=True' -CertAutoGenerationKey $WFCertAutoGenerationKey;

# Add SB Host
$SBRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String 'PASSWORD';

Add-SBHost -FarmMgmtDBConnectionString 'Data Source=sp2013.DOMAIN.int;Initial Catalog=SbManagementDB;Integrated Security=True' -RunAsPassword $SBRunAsPassword -CertAutoGenerationKey $SBCertAutoGenerationKey;

Try
{
    # Create new SB Namespace
    New-SBNamespace -Name 'WorkflowDefaultNamespace' -AddressingScheme 'Path' -ManageUsers 'sp_content@DOMAIN.int','administrator@DOMAIN.int';

    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 'PASSWORD';

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

4. Now, run the Worfklow PowerShell, and execute command by command, to monitor the progress and to catch eventual errors.

wav04

And if everything is fine, you’ll get no mistakes, and you’re ready to go with Windows Azure Workflow

wav05