News Ticker

Integration with Dynamics CRM using Azure Service Bus – Part 1

There is a frequent need to integration Dynamics CRM system with another line of business applications. In modern enterprises, systems residing in silos are generally candidates for an uplift or replacement and any new system deployment generally takes integration into account. Traditionally when we have integrated Dynamics CRM with other business applications; we have used connectors like Scribe, SSIS along with KingswaySoft or CozyRoc, MuleSoft or even build-your-own-code based solutions.

Azure SB Integration 1

Image Source:

With the increasing adoption of Microsoft Azure, now we have another great ESB option called Azure Service Bus as an Integration solution for Enterprises. Azure Service Bus hosted in Azure data centre provides a cloud-based ESB and allows an enterprise to take advantage of its azure investments.

In a series of posts, I’ll try to discuss how can we integrate Line of Business applications with Dynamics CRM using Azure Service Bus as an ESB. In these posts, I’ll take Dynamics CRM Online as an example; however, it will work with Dynamics CRM On-premises as well.

Dynamics CRM and Azure Service Bus Integration

One of the most common integration scenarios is to propagate a Dynamics CRM trigger to an external system. For example, send a notification to an external system when a Case record is resolved in Dynamics CRM.

The following diagram outlines the design pattern for such scenarios.

Azure SB Integration 2

The sequence of the events as identified in the diagrams are as follows –

  1. A New Service End Point is registered within Dynamics CRM Plugin to make the Plugin Azure Aware.
  2. A listener application is registered on Azure Service Bus endpoint, which begins actively listening for any event execution within Dynamics CRM Online.
  3. When a user performs an action (or the action is triggered by the system), Azure-aware Dynamics CRM plugin receives the trigger and can post the request data (as .NET binary/JSON/XML) to Azure Service Bus using the asynchronous service.
  4. The claims posted by Microsoft Dynamics CRM Online Plugin are authenticated. The Azure Service Bus then relays the remote execution context to the listener. The listener processes the context information and performs some business-related task with that information. The service bus notifies the asynchronous service of a successful post and sets the related system job to a completed status.


DO NOT WORRY! I shall slow down now.

Here are some short explanations for some of the terms.

Microsoft Azure Service Bus

Microsoft’s definition of Azure Service Bus is “Service Bus is a generic, cloud-based messaging system for connecting just about anything – applications, services, and devices – wherever they are. Use this learning path to understand how to connect apps running on Azure, on-premises or both.”

Browse to this link to know all about Azure Service Bus.

Service Bus is a multi-tenant cloud service, which means that the service is shared by multiple users. Each user, such as an application developer, creates a namespace, then defines the communication mechanisms she needs within that namespace.

Service Bus provides a multi-tenant service for connecting applications through the cloud.

Service Bus provides a multi-tenant service for connecting applications through the cloud.

Within a namespace, we can use one or more instances of four different communication mechanisms, each of which connects applications in a different way. The choices are:

  1. Queues
  • Provides one-directional communication
  • Each message is received by a single recipient.
  • Stores the sent messages until they are received
  1. Topics
  • Provides one-directional communication using
  • A Single topic can have multiple subscriptions
  • Each subscription can optionally use a filter to receive only messages that match specific criteria.
  1. Relays
  • Provide bi-directional communication.
  • Doesn’t store in-flight messages. Instead, it just passes them on to the destination application.
  1. Event Hubs
  • Provide event and telemetry ingress to the cloud at massive scale, with low latency and high reliability

What else do I need to know for a Dynamics CRM and Azure Service Bus Integration?


  1. Service Bus Authentication: There are two authentication protocols for Azure Service Bus, namely –
  • Shared Access Signature (SAS)
  • Azure Active Directory Access Control Service (ACS)

For Dynamics CRM Integration, we would use ACS.

  1. Service End Point: Service EndPoint represents the Azure Service Bus Endpoint. This is important to integrate Dynamics CRM with Azure Service Bus. We need to register a Service Endpoint in our CRM Organisation using Dynamics CRM Plugin Registration Tool. The beauty is when we register a new Service Endpoint in CRM, service identities, rule groups and number of other settings are automatically configured for us. 
  1. Out-of-the-box Azure-aware Plugin: To post CRM events to the Azure Service Bus, we have to register a CRM Plugin step within the registered Service Endpoint to define what message and entity data should trigger this plugin to execute. The Service Endpoint thereafter uses out-of-the-box Azure-aware Plugin to post the execution context to the Azure Service Bus. 
  1. Custom Azure-aware Plugin: The OOTB Azure-aware plugin cannot process any data returned by the Azure Service Bus, in case bi-directional relay service is used. In such a case we need to develop a custom plugin and make sure our custom plugin can post to Azure Service Bus. 
  1. Azure listener Solution: For the external LOB applications to act when a CRM event is fired, we need an active Azure Listener solution. The listener solution should be Dynamics CRM-aware so that it can process the CRM execution context (sent either as Binary data or JSON or XML) from the Azure Service Bus.

In the next post, we will see step-by-step how to integrate a CRM Online system to Azure Service Hub queue.

About Dipankar Bhattacharya (59 Articles)
A multi-skilled Dynamics 365 Professional with strong experience in delivering IT projects especially across multiple industries. A Microsoft technology evangelist, a regular speaker at tech events, blogger and avid reader. Certified IT Architect and well versed in Solution Architecture of Business Applications using Microsoft platforms like Dynamics 365, Azure and Office 365.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: