Deploying an Application via Script

Parent Previous Next

Deploying a BizTalk application to a BizTalk server or server group using the Deployment Framework for BizTalk is a two-step process:


  1. Install the application MSI on the server
  2. Launch the deployment process


This topic will describe how to deploy an application via script (non-interactive).  Since there are countless scripting tools available (batch files, PowerShell, TFS workflows, etc.) this discussion will convey the general process without going into the details of a particular tool.


Single Server Deployment

Before you begin, you must have a copy of the BizTalk application's MSI created through the previously described steps.  Follow this process to install and deploy a BizTalk application to a single BizTalk server.


Step 1 of 2: Install the MSI

Before the BizTalk application can be deployed to BizTalk, it must be installed on the server:


  1. Copy the application's MSI to the BizTalk server
  2. Install the MSI


In general, you'll install the MSI using the Windows Installer command-line tool msiexec.exe:


msiexec.exe /i MyBizTalkApp.msi /passive /log MyBizTalkAppInstall.log INSTALLDIR="C:\Program Files\MyBizTalkApp\1.0"


The /i parameter specifies the MSI name, /passive activates unattended mode to show only a progress bar and /log creates a log file.  The final, and optional, parameter INSTALLDIR overrides a Windows Installer property that is predefined within the MSI.  INSTALLDIR specifies the file system path at which the application files will be installed.


A good option for remote execution of msiexec.exe across the network on the BizTalk server is Microsoft SysInternals PsExec.  WinRS.exe is another possible option.


Step 2 of 2: Deploy the Application into BizTalk

Now that the BizTalk application's files have been installed on the BizTalk server, the application is ready to be deployed into BizTalk.


The deployment script is executed by MSBuild.exe.  Many servers will have several versions of MSBuild.exe installed: one from .NET Framework 2.0, one from .NET Framework 3.5 and another from .NET Framework 4.0.  Any version should work.  The important thing is to run the 32-bit MSBuild.exe, even on Windows x64.


For this example, I'll assume that .NET Framework 4.0 is installed.


The first command, shown below, exports the environment-specific settings XML files from the settings file spreadsheet (usually named SettingsFileGenerator.xml).


"C:\Program Files\MyBizTalkApp\1.0\Deployment\Framework\DeployTools\EnvironmentSettingsExporter.exe" "C:\Program Files\MyBizTalkApp\1.0\Deployment\EnvironmentSettings\SettingsFileGenerator.xml" "C:\Program Files\MyBizTalkApp\1.0\Deployment\EnvironmentSettings"


The second command, shown below, executes the deployment process.


"%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" /p:DeployBizTalkMgmtDB=true;Configuration=Server;SkipUndeploy=true /target:Deploy /l:FileLogger,Microsoft.Build.Engine;logfile="C:\Program Files\MyBizTalkApp\1.0\DeployResults\DeployResults.txt" "C:\Program Files\MyBizTalkApp\1.0\Deployment\MyBizTalkApp.btdfproj" /p:ENV_SETTINGS="C:\Program Files\MyBizTalkApp\1.0\Deployment\EnvironmentSettings\Exported_ProdSettings.xml"


The /p parameter includes multiple Property=Value pairs separated by semicolons.  This allows MSBuild properties to be defined directly from the command-line, where they will take precedence over default values set within the deployment project.


Pay particular attention to the ENV_SETTINGS property, which points to one of the settings XML files exported from the settings spreadsheet.  In an interactive deployment, this path is collected from the user in the deployment wizard.  With a scripted deployment, you must provide the path yourself.


Multi-Server Deployment (BizTalk Group)

Once you understand how to deploy your application to a single BizTalk server via script, it's easy to extend that knowledge to an entire BizTalk group.


The multi-server deployment process is virtually identical to the single-server process.  The key differences are:


  1. The application MSI must be copied to and installed on every server in your BizTalk group
  2. The deployment script must be executed on every server in your BizTalk group
  3. The DeployBizTalkMgmtDB property must be correctly set on each server


BizTalk requires application binaries and certain other artifacts to be installed on every BizTalk server that runs the application.  However, the BizTalk application, its port bindings, rule policies and more must be registered in the BizTalk databases only once within the group.  The DeployBizTalkMgmtDB property controls whether to deploy application files on the server AND deploy configuration data into the BizTalk databases, or to simply deploy application files on the server.


The recommended process is:


  1. Identify the complete set of BizTalk servers within the BizTalk group that will run the application
  2. Walking through the servers one at a time:
  3.        Copy the application MSI to the server
  4.        Install the MSI
  5.        Deploy the application with DeployBizTalkMgmtDB=false
  6. On the final server in the list, follow steps 3-5 but use DeployBizTalkMgmtDB=true


The deployment process on each individual server is the same as the Single Server Deployment process described above.


Created with the Personal Edition of HelpNDoc: Easily create HTML Help documents