Dynamics CRM and Azure Service Bus Queues Messaging over the cloud

Back

Dynamics CRM and Azure service bus integration Part 1

How to create a service bus in Azure

Introduction

Many of our customers host their own Microsoft Dynamics CRM (now more formally known as Dynamics 365) applications but also need the advantages of the FMS system.  As more and more enterprises move to the cloud we needed an effective way of communicating across the boundaries of on-premise and off-premise installations.

Business applications constantly change and evolve; as such our integration solution also has to change and evolve. We needed the flexibility of a configuration based solution combined with the reliability required for business apps to function.  What we eventually came up with was the Dynamics CRM Connector for FMS.

Dynamics CRM-Connector for FMS

The Dynamics CRM-Connector for FMS – (let’s call it the the CRM-Connector), allows an off-premise or on-premise CRM installation to send and receive business information to and from FMS.  (in fact any configured application can benefit from the connector) – contact us now to find out how you can benefit.   By using the functionality of CRM FetchXML combined with the reliability of the Azure service bus message queues, we created a generic solution allowing raised CRM events ‘create’, ‘update’, ‘delete’ etc to invoke your FetchXML sending the results over the cloud to your on-premise or off-premise back ends.

  • The Dynamics CRM Connector solves the following scenarios

“A new contact has been created and you want a backend service to respond to this event. Your not actually interested in the all contact entity details, you just want the {contact entity address} and for the sake of this discussion a {credit card number from a custom payment entity}. Note that the backend service has no direct connection to your CRM instance.”

To accomplish this create an Azure service bus message queue, install the CRM-Connector plugin and finally use the Fortesium CRM-Connecter service to read messages of the queue and place it anywhere on your infrastructure.  All that is now needed is to write to some custom FetchXML for the plugin that will be invoked when a contact is created.

For example

<fetch>
  <entity name="customeraddress" >
    <filter type="and" >
      <condition attribute="addresstypecode" operator="eq" value="453670000" />
    </filter>
    <attribute name="city" />
    <attribute name="postalcode" />
    <attribute name="line1" />
    <attribute name="line2" />
    <attribute name="line3" />

    <link-entity name="fort_payment" from="fort_paymentcontact" to="parentid" alias="fort_payment">
      <attribute name="fort_visacardnumber" />
    </link-entity>
  </entity>
</fetch>

With this in place every time a new contact is created in CRM your app can receive the {contact address} and the {payment card no}.  If you need more data, no coding is required – just update the FetchXml.

This sequence of blog posts shows how you can install and run the CRM-Connector.

Create a service bus in Azure

The steps may look complex but in actual fact its all very simple and straightforward.  To begin let’s create a service bus in Azure, add a queue and garner the information needed to connect to it.

  1. Navigate to Azure portal with your credentials, Click [+ New] and search for [Service Bus]
  2. On the result page choose Service Bus and click [Create], a new blade will pop up – complete the required information and create the service bus.
  3. Wait until the deployment completes (it can take 2 or 3 minutes)
  4. Now we have our service bus , we need to create a queue that we can use for communication to and from the CRM-Connector. To create a new queue, find the resource in the dashboard and click [+ Queue]
  5. On the queue creation blade enter the name of your queue
  6. After the queue has been created, Click on the queue from the list to open the Queue details blade.
  7. We need to generate an access key (SAS Access key) for this queue so that we can provide the connection details to other applications (like CRM) to communicate.  Read more about it over here. Click on the Shared Access Policies [+ Add]

  8. Give policy name some thing relevant to you and provide only “Send” and “Listen” permissions to the queue.  I am not giving “Manage” access to any one.
  9. Clicking on the new policy will show the policy details.  We will need this information in the next section when configuring the CRM plugin.

2 thoughts on “Dynamics CRM and Azure Service Bus Queues Messaging over the cloud

Comments are closed.