Implement BAM

Topics: Technical Questions, Usage Scenarios
Jun 11, 2009 at 9:09 PM

Trying to figure out how to implement BAM with the latest VTP version of MSE. I created the policy and applied it on MSE Runtime. The policy looks like this:

<PolicyModel xmlns="" xmlns:mse="" xmlns:x="">
  <bam:ServiceBehaviorExtensionElement BAMPIDBConnectionString="Data Source=localhost;Initial Catalog=BizTalkMgmtDb;integrated security=sspi" xmlns:bam="clr-namespace:Microsoft.MSE.Behaviors.BAM;assembly=Microsoft.MSE.Behaviors.BAM">
  <ServiceDebugElement IncludeExceptionDetailInFaults="true" xmlns="clr-namespace:System.ServiceModel.Configuration;assembly=System.ServiceModel">

The tables and views are all created in the database using the BAM tool and BAM definition files.

I am not getting any error as well as nothing gets logged to BAM tables. Did anybody got this implemented successfuly?

Jun 12, 2009 at 12:14 AM

Make sure the "BizTalk Server Application Service" is running. 

Jun 12, 2009 at 2:20 PM

Yes the 'BizTalk Server Application Service" is running.

Jun 16, 2009 at 6:51 PM

Do you think if there is a problem with my connection string? Is there any way to debug it?

If possible please send me a sample BAM policy.

Jun 16, 2009 at 7:02 PM
Edited Jun 16, 2009 at 7:05 PM


Here is the detailed list of steps.  (unfortunately could not paste the images). 

Load the MSE BAM Observation Model

1.       Open a Cmd window

2.       Go to the MSE Installation folder (in my case it is -> “C:\Program Files\Microsoft Service Oriented Infrastructure")

3.       Once there we have to deploy the BAM Observation model using the BM utility (you can find the BM utility in the following folder  <BAM Installation Dir>\Tracking)

4.       In the Cmd window type the following

a.       C:\Program Files\Microsoft Service Oriented Infrastructure>"C:\Program Files (x86)\Microsoft BizTalk Server 2009\Tracking\bm.exe" deploy-all -DefinitionFile:MSE_Feb09CTP_BAM_Definition.xml

5.       You should see the following messages:

Note. You can remove the BAM definition by using the “remove-all” in the BM utility.

Configure the Behavior in the MSE Model Viewer


At this point the MSE Bam definition is deployed. Next, define the BAM policy using the following policy assertion type:

<bam:ServiceBehaviorExtensionElement BAMPIDBConnectionString="Integrated Security=true;Data Source=.;Initial Catalog=BizTalkMsgBoxDb" xmlns:bam="clr-namespace:Microsoft.MSE.Behaviors.BAM;assembly=Microsoft.MSE.Behaviors.BAM"></bam:ServiceBehaviorExtensionElement>

1.       Open the Model Viewer (Admin Tool) make sure you go into the Policy Management Layout  (Layout -> Policy Management)

2.       Import a WCF Policy Assertion Type using the Following Wizard   (Tool -> Load Policy Components -> WCF Policy Assertion Type

3.       Click <Next>

4.       In the “Define Policy Xaml” step copy the XAML Assertion above (modify to suit your needs -> Datasource =<your server>


5.       Click <Next>

6.       In the “Assertion Type / Assertion Details” step, give the Assertion Type and Assertion a name. (i.e. AssertionType Name: BAM Assertion Type  Assertion Name: BAM Assertion)  in the Assertion Type Subjects click in the “Endpoint” checkbox, this will automatically select the “Runtime Server” as well.

7.       Click <Next> until you are finished with the wizard.

8.       In the Model Viewer, select the “Policy Management” Layout.

9.       In the “POLICIES” section under Configurations (bottom half of the Model Viewer), Do a “Right Mouse Click”  in a space between existing Policies 


10.   Select the “Add New Item” option in the context menu that will pop up.

11.   Give the Policy a Name and select the Associated Policy Entity to be “Endpoint”


12.   Click <Apply> and close the Policy Details screen.13.   While In the BAM Policy Details click on the “unrelated” tab in the “ASSERTIONS” area. Drag and Drop the “BAM Assertion” over the “BAM Policy” element.


14.   Select the “Endpoint” as the Associated Policy Entity.

15.   Click <Close>

16.   Now, you can go back to the “End to End Item Management”.

17.   Double Click on an Endpoint where you want to enable BAM.

18.   Make sure you can see the “Policy” (Drag item here) area in the Endpoint details screen.

19.   In the “POLICIES” section click in the “Unrelated” tab to see the available Policies that can be assigned to Endpoints.

20.   Click on the “BAM Policy” (or whatever name you gave it) and without letting go of the mouse button drag it over to the Policy area in the Endpoint and drop it there.

21.   The Behavior should be attached and ready to capture data.


Testing and BAM Portal

22.   To test, run a few services using the Service Tester (or other tool) and go to the BAM Portal (http://<your BTS Server>/BAM/).  You should be able to query BAM data or see the Pivots that we included as part of the Observation Model / Definition.

Jun 24, 2009 at 9:37 AM



Is it also necessary to deploy the file MSE_Feb09CTP_BAM_Definition.xlsx ?



Jun 24, 2009 at 5:16 PM

Hello again! I have yet another question.


Is it possible to extend your MSE BAM Model? I guess the xml and xls would be simple to alter...

Imagine that i like the actual model but... i would like to have one extra field (an extra  activity item). Is there any way to extend the code implemented already (probably implemented in Microsoft.MSE.Behaviors.BAM)?



Jun 29, 2009 at 4:01 PM

Hello once again. This post extends the previous one (making it obsolete).


I was able to follow your "tutorial" on how to implement BAM. Thank you for posting that information.

In your BAM model there is a lot of valuable information. But we were hoping to add even more information (for example, we would like to persist the SOAP messages themselves). 

I analyzed the code you implemented using reflector and concluded that you retrieve almost all the information using arguments returned by internal MSE events. 

Is there any way for us to extend this model to persist the SOAP messages (or any other arguments for that matter)?

I also heard rumours that you are preparing a more in depth document on MSE/BAM. Is this true and is there a date for the release of this particular document?


Thank you in advanced.



Jul 1, 2009 at 1:23 PM

Glad to hear it helped.

you are right the BAM Behavior is used to send collected information from internal MSE events.  that is the way we can publish information specific to the "Enterprise Service Model".

the SOAP messages are outisde the coverage of the BAM observation model, but what you could do is create a specific behavior to log what you need. Create a custom WCF behavior that inspects messages, then a policy assertion and then a policy that can be assigned to an endpoint, the custom WCF behavior would have to intercept the message.  or you can use the WCF tracing capabilities that are available out of the box.  check out this blog ( 

we are working on providing more guidance and improving the MSE/BAM model but we don't have a target date for that.