CRM BizTalk Integration using Azure Service Bus

You may face the same challenges that I experienced when integrating Microsoft Dynamics CRM and BizTalk. The objective is to capture events in real-time and transmit them to an outside system without losing the order of events. There are two web methods exposed by CRM web services, “Retrieve” and “RetrieveMultiple”. The CRM web services provide a way of querying different entities to achieve what we wanted. However, I tried a different approach to solve this integration challenge by using Azure Service Bus Queues. Azure Service Bus Queues provide a robust and flexible implementation of Publish-Subscribe pattern. The picture depicts the scenario that we have implemented.

visiodiagram

In this scenario Azure Service Bus (queue) is used as the means of connecting the two pieces of integration, i.e. CRM and BizTalk. The first part of this approach deals with how the Azure Service Bus will communicate with BizTalk. Second part involves how CRM can be easily configured to push messages to the Azure Service Bus Queue.

Part 1: Integration between Azure Service Bus and BizTalk

Steps for creating a new Azure Service Bus Queue:

  • Create a new Azure Service Bus with the below command. Download link – Azure Powershell

 New-AzureSBNamespace -Name “MyCrmDemoACS” -Location “Central US”
ps

 

  • Create a queue from the Azure portal

azure portal queue

  • Create a new BizTalk receive location (BizTalk RL) that will be polling the queue created in previous step for new messages. The BizTalk RL uses the Service Bus adapter. Configure the BizTalk RL by following the steps given below
    • Type the Url to the Service Bus Queue in the General Tab
    • Type the AccessControl STS Url on the authentication tab. It would be something like, https://<yourservicebusnamehere>-sb.accesscontrol.windows.net/
    • Copy and paste the Issuer Name, Issuer Key from the Azure Portal (as shown below) into the authentication tab.

accessconn

Part 2: Integration between CRM and the Azure Service Bus.

The CRM online instance ships with an “Azure Plugin” that can basically push the different events occurring within CRM to the Azure Service bus. The below series of steps should be followed in order to properly register the Azure plugin in CRM:

Before registering the endpoint you will need the PluginRegistration tool which can be downloaded with the SDK. Download here.

Register the Service Endpoint using Plugin Registration tool:

  • Type a suitable name for this service endpoint.
  • Type the Azure Service Bus namespace in the Solution Namespace textbox.
  • Copy and paste the URL (from the connection string) in the path textbox.
  • Click Save & Configure Azure Access Control Service (ACS).

svcendpointreg

Configure the ACS

  • Management Key –Paste the default key of the service bus
  • Certificate file – Set to the CRM certificate file
  • Issuer Name – set to the issuer name of the CRM application

acsconfig

Register the New Step

  • Type the corresponding step/event which will trigger this.
  • Type the entity associated with the event.
  • Select the newly registered ServiceEndpoint for the Event Handler.
  • Click ‘Register New Step’.

regstep

These are all the steps needed for configuring the two parts of our integration. Upon creating a new contact record, the CRM step was executed (system jobs) and the message was pushed into the Azure Service Bus Queue. When I enabled the BizTalk receive location, the messages were retrieved from the queue.

Posted in Azure, BizTalk, Dynamics CRM | Leave a comment

Creating a Windows 10 Preview VHD That Can Run as a Hyper-V VM and Can Boot Natively

Introduction

When the Windows 10 Technical Preview came out earlier this month, I wanted to see kick the tires a bit and see what was new. However, I need my laptop to work reliably, so I couldn’t take the risk of installing Windows 10 over my Windows 8.1 installation.

So, I decided to install it to a Virtual Machine (VM) running in Hyper-V. This would allow me to run Windows 10 in a “sandbox” that would not affect my primary operating system. It would also allow me to multitask – doing my normal day-to-day activities on my laptop, while still “playing around” with Windows 10.

The other thing I wanted to be able to do is native boot into the Virtual Hard Disk (VHD) used by this VM. VHD native boot is a nice feature that was added with Windows 7 and Server 2008 R2. When you boot into a VHD, you are running everything in it on bare metal except for the disk. There are 2 advantages to doing this. The first is performance – you use all CPU cores and all of the memory on the computer and there is no virtualization layer to go through (except for the disk as mentioned above). The second is that you can verify that Windows 10 will work on the hardware of your computer – you can’t do that running in a VM since everything is virtualized.

Read More »

Posted in Azure, IaaS | Tagged , , , , , , , | Leave a comment

Installing SharePoint 2010 SP2

I was tasked last week with learning how to install SharePoint 2010 as part of our SharePoint IT Training Module.  It’ll be easy they told me, or maybe they didn’t tell me that and I told myself that.  It’s only an installation, how hard can it be?  Famous Last words.  Well after a long time setting up every little thing I get hit with this error and spend a day trying to get past it trying a number of different strategies :

Read More »

Posted in Installation, SharePoint, SharePoint 2010, SharePoint Server, Tips and Tricks | Tagged , , , | Leave a comment

Displaying Enhanced Rich Text in Content Query Web Part

SharePoint has the Content Query web part, which is a control that allows a user to display an aggregated list of items based on some criteria. You can choose to return items from all sites within a site collection or from a specific list; all based on a list type and content type. You also get a few different display options, but if you try to return an Enhanced Rich Text field, that is to say some HTML and CSS Styling, the results are a bit funky. Read More »

Posted in SharePoint, SharePoint 2010, Tips and Tricks, Web Parts | Tagged | Leave a comment

WCF-WebHttp and custom JSON error messages

I’m currently working on a solution that exposes a BizTalk Orchestration as a RESTful webservice using WCF-WebHttp.  Upon successful processing of the message, the service returns binary data for the client to download.  However, if the processing fails, I wanted the service to return application/json data with an error message that would be suitable for consumers – I did not want Stack Traces or other internal details to be provided that could potentially be used by malicious consumers.  Further, I wanted to ensure this information was sent in the same session.

Initially, I created a schema with my sanitized error information, set the Fault Operation Message Message Type to that schema, and enabled “Include exception details in faults.”  While this did end up including my custom error message, it also included the extra information I was trying to avoid.  It also meant always sending back the error reply using HTTP status code 500, which is undesirable if the error is actually in the message submitted.  Finally, the message was being returned in XML, which would be more challenging for my JavaScript-based clients to parse.

To resolve these issues, I created a custom WCF Behavior with three classes.

Read More »

Posted in .NET Framework, BizTalk, Enterprise .NET, JavaScript, User Experience, WCF | Leave a comment

Introducing the T-Connect EDI File Splitter

A common trend that we have been seeing recently is the similarities in the pain points that companies are often faced with.  One of those such pain points is the difficulty in quickly receiving and processing large EDI files having a file size over 10 MB.  In one instance, there was a need to receive a HIPAA EDI 834 Enrollment file totaling 1.3 GB, containing roughly 800,000 enrollments.  The already powerful BizTalk Server in a 1-1 architecture – 1 BizTalk Server, 1 SQL Server, was having difficulty processing the file.  The file would take several hours to process, often taking up several gigabytes of drive space to attempt to disassemble the file using the EdiDisassembler pipeline. Read More »

Posted in Announcements, BizTalk, Enterprise .NET, General, Performance Tuning | Tagged , , , , , , , , , | Comments closed

XLANGs Object Reference Error when dynamically loading a map in BizTalk

This was one of those very frustrating errors that had a very simple solution.  I had an orchestration that was dynamically loading a map using a Fully Qualified Name (FQN) that is stored in BRE.  The exception looked like this:

{ORCHESTRATION_NAME} encountered an error: Object reference not set to an instance of an object.
at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
at {ORCHESTRATION_NAME}.segment3(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

 Many times, this is the result of not deploying your DLL to the GAC, or not having a schema available in the Management Database.  I double checked both of those, and they were there.  I removed them and manually reinstalled them using gacutil, still got the same error.  It finally occurred to me to use reflection on the assembly to see if the FQN was wrong, and that was indeed my culprit.  The class name had .Outbound appended to it, and my orchestration was trying to load a class that ended in .Maps.  I could have changed the FQL in the BRE, but that would have been inconsistent with naming conventions elsewhere in the project.

The source of the error was adding the map to a Solution subfolder in Visual Studio:

BlogPost1

This made the Namespace of the map default to Maps.Outbound:

BlogPost2

Changing the highlighted property to .Maps and rebuilding/deploying fixed the issue.

Posted in .NET Framework, BizTalk, BRE, Enterprise .NET | Tagged , , , , , | Leave a comment

Continuous Integration with TFS and Azure Cloud Services

Microsoft provides a useful tutorial (located here) for running a TFS Continuous Delivery configuration, and automatically publishing to Azure. This tutorial, while instructive, is somewhat out of date, and it may be useful to have a more personalized experience of building such a continuous deployment, while running through the instructions on the tutorial.

As may be the case for others, the TFS server used for running automated builds was already setup and configured, and the project to be built already linked to this server, so I won’t go into that here. The build server is running TFS 2013, and the ASP.NET MVC5 application being built and deployed is running on Visual Studio 2013.

After verifying the functionality of the build server, I created a package build in TFS Team Build. These configuration settings are for the most part self-explanatory, but the exact configuration in the Process page required a little more work:

Read More »

Posted in Architecture and Development, Azure, Cloud | Tagged , , , | Leave a comment

PostSharp Logging and Fundamentals with C#


Introduction
Before we start learning PostSharp we must understand the idea of Aspect Oriented Programming.

Aspect oriented programming, or “AOP”, is the programming style which allows the separation of distinct, independent functions. This inevitably increases code modularity and in turn drives towards cohesive functionality. We tend to classify these distinct functions as cross-cutting concerns due to the fact that they can “cut across” multiple abstractions in a program. These concerns classify the major parts of a whole application such as the business logic, data model or the user interface. These concerns could be broken down even further if need be. This high level of encapsulation is the central concept behind AOP.

Read More »

Posted in 0-Uncategorized | Leave a comment

Solution to Common BizTalk Deployment errors in Visual Studio

There are a few common deployment errors in Microsoft Visual Studio when redeploying a previously deployed BizTalk project.

“Failed to add resource(s). Change requests failed for some resource.  BizTalkAssemblyResourceManager failed to complete end type change request.  Failed to update binding information.  Cannot update receive port “”.  Transform “” not found”

Untitled picture Read More »

Posted in .NET Framework, BizTalk | Tagged , , , , , | Comments closed