Close

BTDF Determine Environment

To identify the deployment environment in BizTalk Deployment Framework scripts, you use an environment variable by default. You can also use a RSA certificate however. To this end you will have to create a BTDF extension. In this post, I will not show the extension code. This post is just aims to make you aware of the possibility a certificate is used. Gotchas:

  • Self signed RSA certificates can easily be generated via IIS. Use a certificate that doesn’t expire and make a backup. The certificate must be added to the personal certificate store of the computer account.
  • The deployment environment can only be determined if a setting PasswordEncryptionPublicKey is added to the BTDF settings file. PasswordEncryptionPublicKey contains the base64 encoded public key. You create a certificate per environment.
  • As mentioned before, a RSA certificate can be used to determine the environment. As an added advantage you can also use certificates to decrypt sensitive information from the settings file. To decrypt sensitive information add ‘__’ in front of the setting name. Example: ‘Password’ will be ‘__Password’. On the next deployment, the field will be encrypted using the public key.
  • To view the installed certificate, enter Start/Run mmc en Add the Certificates add-in.

BTDF Extensions are added to path:

C:\Program Files (x86)\MSBuild\DeploymentFrameworkForBizTalk\5.0

As an example, task DetermineCurrentEnvironment.cs is contained in a library named BtdfExtensions.Tasks.dll. In the Deployment file Deployment.btdfproj of solution BtdfExtensions, you will see the other Extension artefacts are also added to folder C:\Program Files (x86)\MSBuild\DeploymentFrameworkForBizTalk\5.0.
Example:

<Copy DestinationFolder="$(MSBuildProgramFiles32)\MSBuild\DeploymentFrameworkForBizTalk\5.0\" SourceFiles="@(TargetsToCopy)"/>

Note that $(MSBuildProgramFiles32) is a reserved property of MSBuild, that contains value C:\Program Files (x86)\MSBuild. The extensions include scripts, tasks, targets and xslt’s.