How to Integrate Dynamics 365 with Azure Service Bus

Here is next blog on “How to Integrate Dynamics 365 with Azure Service Bus” without writing any code.

Azure Service Bus and Dynamics 365

Azure Service Bus provides a native integration with Dynamics 365. This means we can send messages to Azure Service Bus from CRM when an event occurs, these messages can then be used to integrate with several downstream applications.

SAS (Shared Access Signature) authentication is used to access Service Bus resources. SAS authentication involves configuring a cryptographic key with associated rights on a Service Bus resource. Clients such as Dynamics CRM can get access to that resource by presenting a SAS token.

Let us build a CRM to Azure Service Bus integration.

Pre-Requisites:

  1. Azure Subscription
  2. Dynamics 365 CE instance
  3. Dynamics 365 Plugin Registration Tool

Here is an overview of how to integrate Dynamics 365 CE with Azure bus by without writing any code

  1. Create an Azure Service Bus in the Azure Portal
  2. Create a Queue on the Bus
  3. Create a Shared Access Key (SAS) for writing messages to the Bus
  4. Copy the Connection String
  5. Register a Service Endpoint in Dynamics with the Plugin Registration Tool
  6. Register a Step under the Service Endpoint for the Entity we want to send
  7. Perform the action in the Dynamics 365 CE and check the results with Service Bus Explorer/Azure Portal.

Step 1: Configure Azure Service Bus and obtain a connection string

You will need an active Microsoft Azure account. Browse to the Azure Portal and click Service Bus. We will start by creating a new namespace.

Next, create a new Service Bus instance by clicking on the below Add button.

Next, create a new Service Bus Messaging Entity such as Queue.

Finally, obtain the connection string by browsing to newly created Shared Access Policy or you can create your own Shared Access Policy.

After the SAS has been created. Then click on the copy button next to the Primary Connection String. We will be using this to tell Dynamics 365 CE in the Plugin Registration Tool.

Step 2: Use CRM plugin tool to make a connection to CRM and Azure Service Bus

Open the Dynamics 365 CE Plugin Registration Tool and Create new connection and login to your Dynamics CRM 365. Next, register a new Service Endpoint.

Copy and paste the connection string obtained in Step 1 in the below high-lighted textbox.

New Service Endpoint now appears in the list of registered plugins.

Step 3: Define events which will post messages to Azure Service Bus

Right-click the Service Endpoint and add a new step. Enter trigger action such as create, delete, etc. in the ‘Message’ box. Enter the primary Entity on which the action will occur. Also, mark the execution mode as ‘Asynchronous’.

Now we have configured the endpoint in Plugin Registration Tool, it is time to test it out. Login to you Dynamics CRM 365 CE and go to case and create a new case. This should trigger an action on the Service Endpoint.

Verify that a message is queued on the Azure Service Bus. Go to Queues -> Overview you can see all the messages in the queue.

And that’s how you can easily configure Azure Service Bus for Dynamics 365 CE without writing any code.

I hope this blog post helps you. If you are interested to know more about this topic then, I encourage you to check out my blog on this.

One comment

Leave a Reply