Integrating Dynamics CRM To Azure Service Bus

Introduction 

Microsoft Dynamics CRM is a next-generation data-driven ERP application that empowers businesses to improvise interaction with customers, tracking the existing business as well as gaining more business. Dynamics is available as both cloud-based as well as an on-premise solution that can be hosted and managed within the organizational infrastructure.

Usually, in organizations, multiple systems have been implemented over a course of time and every system plays an prominent role in performing multiple activities by different officials, and so communication, or we can say data exchange, between these different applications is needed at every point.

An organization relies upon multiple solutions for undertaking this data exchange between applications, and one of the reliable solutions is Azure Service Bus, which has all the must-have features.

Azure Service Bus offers multiple advantages and best among all is its capability to retain the message/information until the other application doesn’t pull the information.

Features of Azure Service Bus at a glance:

  • Applications can communicate with each other seamlessly, irrespective of their technologies and their downtimes
  • Azure Service Bus protects the application from any temporary increase in requests sent from one application to another

  • The applications are not connected directly, and so the teams need not rely upon understanding the technologies, and just need to work over conventional ways of coding wherein JSON envelope can be considered as one of the universal standards
  • Multiple applications can be integrated through a single service bus, that can pull in messages from different queues without any issues or any extra effort by the developer 
Steps to be followed for setting up the integration,
 
Login to Azure Portal and set up a Azure Service Bus followed by setting up a Queue in the same
 
Now we need to copy the connection string of this service bus and register the endpoint in Dynamics CRM using the Plugin Registration Tool
 
 
 
 
After registering the Service Bus Endpoint, we need to have the GUID of the endpoint for the same, you may use the Advance Find of Dynamics CRM : any other utility from XrmToolBox as the GUID will be needed to be used in the code to send the message from Dynamics CRM to Azure Service BUS

 
Now it’s the most important aspect of writing the code to send out the required information to Azure Service Bus from Dynamics CRM, and here in am using the Plugin to send to information.
 
The plugin will be registered over the required entity, which will be triggered upon subsequent action on the entity, and thus using the GUID of service end point will be sending out the information to Azure Service Bus.
 
 
I registered the plugin over creation of Contact Record in Dynamics CRM using the plugin registration tool
 
 
I have enabled the Tracking logs in the application to track on creation of contact record the Plugin gets triggered and message is sent to Azure Service Bus

 
I logged in Azure Portal, and we can see that the Queue has couple of Active Messages available in there which show that the Dynamics CRM has sent out the messages successfully and the messages will be waiting in the QUEUE until the moment another application fetches it to process it further.