Tool to Extract BAM Activities

While migrating from BizTalk 2013 to BizTalk 2016, there was a need to deploy all existing BAM activities to BizTalk 2016 environment. However, bm.exe allows you to extract all BAM activities into a single file. If you try to use this extracted file for deploying BAM Activity definitions, it will not deploy any activity and most likely to stay in a running state. Therefore, I decided to create a simple Windows application which will connect to the source BAMPrimaryImport database, get the activity definition and the corresponding view and create a file for every BAM activity. A batch file can then be used to deploy the BAM Activity definitions to destination BAMPrimaryImport database from the extracted files.

The connection string is required to be pasted in the format:
Data Source=[SQLSERVERNAME]\[INSTANCENAME if any];Initial Catalog=BAMPrimaryImport;Integrated Security=SSPI;Persist Security Info=False;Password=[PASSWORD];User ID=[USERNAME];

The SQL query used to get desired result is:

SELECT
A.ActivityName,A.DefinitionXml,V.ViewName,V.DefinitionXml from bam_Metadata_Activities A INNER JOIN bam_Metadata_ActivityViews AV on AV.ActivityName = A.ActivityName INNER JOIN
bam_Metadata_Views V ON AV.ViewName = V.ViewName

A batch file content:

bm.exe deploy-all -DefinitionFile:C:\Temp\BAM\bam_<Activity1Name>.xml
bm.exe deploy-all -DefinitionFile:C:\Temp\BAM\bam_<Activity2Name>.xml

A word of caution- this tool doesn’t support multiple views for same Activity Definition.

Code Snippet & executable at: https://github.com/abhijeetg2005/BizTalk

Leave a Reply

Your email address will not be published.