One-Touch BizTalk Configuration in Windows Azure Virtual Machine

Hello, today, I would like to write some blog about the new improvements of the Windows Azure Platform.

After the General Availability, Scott Guthrie has announced  some improvements about Virtual Machine here.

What is interesting here is the support for Optionally Enabling Remote Powershell on Windows Virtual Machine. Why is it cool ? Because with this you can automate not only the provisioning of a Virtual Machine but also automate some task of installation and configuration. We’ve already see how to provision a BizTalk Virtual Machine in a previous post. In this post, with the new capability, we will go further with an automatic configuration of BizTalk after the provision of the Virtual Machine.

Here is the different steps that we’re going to achieve with this scripts:

  1. Provisioning BizTalk Evaluation Virtual Machine from the gallery
  2. Configure the remote session
  3. Downloading the prerequisites
  4. Configuring remotely the BizTalk Engine
  5. Wait… with a coffee Sourire

The prerequisites for the execution of the scripts is the latest version of the Windows Azure PowerShell Command Lets available here

Then, the procedure needs 3 PowerShell script files :

  • Azure BizTalk One Touch.ps1 : regroup all the scripts command to do the work
  • BizTalk.Management.Automation.psd1 and BizTalk.Management.Automation.psm1 that regroup custom function needed by the principal script and embedded in a module.

You need to copy the Module files in the PowerShell Module Path, if you do not know this path, just type

 $env:psmodulepath 

in a powershell windows to know the list of path where the module are loaded.

Then you need to fill the different parameters according to your subscription and the name of the Virtual Machine you want to create.

First of all, you need to fill the different parameters according to your subscription :

 
########################################### #Azure Subscription Configuration ########################################### 
$subName = '' 
$subId = '' 
$vmStorageAccount = '' 
$cert = Get-Item Cert:\CurrentUser\My\ 

########################################### #VM Configuration ########################################### 
$vmName = ''; 
$adminUserName = '' 
$adminPassword = '' 

########################################### #BizTalk Configuration ########################################### 
$BizTalkAppAccount = "" 
$BizTalkAppPassword = "" 

Here is some details about the script :

A new Virtual Machine is created with this azure Command Let :

 
$azureQuickVMResult = New-AzureQuickVM -Windows -ServiceName $vmName ` 
-name $vmName ` 
-ImageName "2cdc6229df6344129ee553dd3499f0d3__BizTalk-Server-2013-Evaluation" ` 
-EnableWinRMHttp -Location "West Europe" ` 
-AdminUsername $adminUserName ` 
-Password $adminPassword ` 
-InstanceSize Small 

Then I use a custom function which will wait until the Virtual Machine Status is in ReadyRole Mode. This function is Get-AzureVM using the name of the VM to retrieve the Vm Status, output the status and loop until a timeout if the status is not desired.

image

Then I use a new commandlet called GetAzureWinRMUri with the name of the Vm. This commandlet allow me to retrieve the Powershell Remote Configuration of the Vm and especially the port number that is not fixed.

Then I Create the credentials and the PowerShell Session :

 
Write-host "Get Azure Windows Remote Uri" 
$winRmConfiguration = Get-AzureWinRMUri $vmName; 

$secpasswd = ConvertTo-SecureString $adminPassword -AsPlainText -Force 
$mycreds = New-Object System.Management.Automation.PSCredential ($adminUserName, $secpasswd) 

Write-host "Create Session to Virtual Machine" 
$pssessionOption = New-PSSessionOption -SkipCACheck $mysession = New-PSSession -ComputerName "$($vmName).cloudapp.net" -Credential $mycreds -Port $winRmConfiguration.Port -UseSSL -Verbose -SessionOption $pssessionOption 

An interesting part in this code is the use of the $pssessionOption, used with –SkipCACheck, this allows us to not Check the Certificate Authorities and allow us to connect to the VM without knowing the certificate (necessary because we use –UseSSL)

Then I use the function Invoke-Command with the current session in parameters to launch all the command in the Virtual Machine (localy)

BizTalk can be configured automatically (in pseudo-silent mode) using Configuration.exe in commandline with the following parameters :

image

Indeed, if some of you have already tried to launch the configuration.exe remotely, some of you might have noticed that nothing really happens and the log file doesn’t show an good information on the error. It’s because the configuration.exe is base on a Form Component that use MessageBox.Show even in silent mode.

If you look at the error, you will encountered this following :

image

If you look at the Information Message – Windows Error Reporting, you will see a link to a detailed dump file where you could find the following stack trace :

 
<?xml version="1.0" encoding="utf-16"?>
<WatsonInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <osVersion>Microsoft Windows NT 6.2.9200.0</osVersion>
  <AppName>Microsoft ® BizTalk ® Server 2013</AppName>
  <AppVersion>3.10.229.0</AppVersion>
  <exceptionString>System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at Microsoft.BizTalk.Configuration.Program.RunConfigProgressUIThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</exceptionString>
  <exceptionMessage>Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.</exceptionMessage>
  <exceptionStackTrace>   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()
   at Microsoft.BizTalk.Configuration.Program.RunConfigProgressUIThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()</exceptionStackTrace>
  <targetSite>System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.IWin32Window)</targetSite>
  <HResult>80131509</HResult>
</WatsonInfo>
 

To accomplish the configuration, I’ve needed to rewrite this component.

What I have done is simply (but after a little bit of re-engineering…) create an other piece of code that wrap the configuration.exe tools. I‘ve tried to re-use as many as possible the original code of this component with a change to be sure to not use any MessageBox.Show.

System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

One this new program compiled and work, all what you need is to copy it in the BizTalk Installation Path and launch it with the same parameters.

An other issue that I encountered was security issue due to the remote PowerShell. I think this is due to some double hop credentials that are not allowed. To by-pass this constraint, I decided to create a Schedule Task with the required execution right, launch it and watch for the log file to know in real-time the progress of the installation.

image

The file Log watcher is simply done by the Get-Content command with the –wait parameters.

All the necessary file are downloaded and transformed (using the specified parameters on top of the script) from my blob storage account (public) so you can use it. This is done by the Download-File, configure-BizTalk and Configure-BizTalkConfigurationTask function of the module.

And  finally, for the next step of this process, I install the Powershell Provider for BizTalk that will allow me to control my BizTalk in command line.

That’s all, after less than 20 minutes you will have a complete BizTalk Evaluation Environment  ready for use.

image

Thanks to Windows Azure Platform. This platform really ROCKS!!!!!!!!!!!!!

You will find all the scripts in a gist repository :

This entry was posted in Azure, BizTalk, English and tagged , , . Bookmark the permalink.

13 Responses to One-Touch BizTalk Configuration in Windows Azure Virtual Machine

  1. Pingback: Scott Banwart's Blog › Distributed Weekly 206

  2. Pingback: Need a single server BizTalk Environment on Azure IaaS? Just give this a click! - Stephen W. Thomas BizTalk MVP - BizTalk Blogs - BizTalk Gurus

  3. Pingback: Me, Azure, .NET and BizTalkOne Click BizTalk Multi-Server Environment Azure provisioning and full configuration | Me, Azure, .NET and BizTalk

  4. Pingback: Me, Azure, .NET and BizTalkHow to: BizTalk Server 2013 Sysprep Development Image | Me, Azure, .NET and BizTalk

  5. Great post! I’m interested in how the “ExtendedConfiguration.exe” is implemented. Can you post the source code for that one as well?

    • I’ll see if I retrieve the code, but you’ve to know that this code is under Microsoft Licence. That’s why I don’t have post this code before.

      • Martin says:

        Hi Jeremie,
        Having a similar issue right now,
        need to update Biztalk HIS 2010 for a few thousand computer remotely…
        any way to get an hand on the extendedConfiguration.exe file.. so I can finally bypass the limitation I’m having.

        Even with the -i in psexec, I’m getting an error and the config isnt applied.

        Thanks you for letting me know.

        Martin

      • Hello Martin, how can I share the code with you ?

  6. Satya says:

    Do you have that exe, or we have to compile it.

  7. Dheer says:

    Hi,
    First of all this is really cool .. I am having the same issue while doing a remote biztalk configuration .. Can you share the source code so that i can run-through it .. I also raised a support ticket with Microsoft to see if they can come up with anything ..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s