A recent client project required using Azure Online Service to implement an effective solution for on-premise integration. In most Dynamics CRM integration, developers more often use SSIS approach to achieve the integration requirement. However, this approach lacks data event driven which may not be suitable when the information is critical and requires instant update to the destination data repository, or a scenario where latency must be kept to minimum. Using messaging like system in Azure Service Bus can provide robust and scalable integration for different kinds of integration requirement.

Advantages of using Azure Service Bus

  • Azure Service Bus can be configured as message queue, relay or event hubs.
  • Message is handled in FIFO manner which can avoid being out of order during integration.
  • In messaging model, it allows integration decouple from core process to improve scalability.
  • In messaging model, the destination process can be offline without interrupting the Dynamics CRM core process. Integration can be resumed when the integration process is back online.
  • It allows an organisation to perform hybrid integration between Online and On-premise without exposing service endpoint to any internet connection, which can reduce surface attack to the organisation network.

Setting up Azure Service Bus

  1. Register a new or use existing Azure subscription.
  2. Connect to Azure management web portal.
  3. Create Service Bus from the management portal as below.

dynamics crm and azure service bus integration

  1. Click New to create a new message queue.


  1. Click CREATE A NEW QUEUE to provision a new message queue.
  2. Navigate to the newly created queue.


  1. Click configure to setup the shared access policies.


  1. Enter a new policy name and the permission type, then click SAVE to add access policy.


  1. After the policy is created, use the generated key to create a Service Endpoint in Dynamics CRM.


Adding Service Endpoint in Dynamics CRM

  1. Open Plugin Registration Tools from Dynamics CRM SDK.
  2. Connect to the Dynamics CRM instance.
  3. Click Register New Service Endpoint from Register menu tab.


  1. Fill in the Service Bus message queue detail, and paste the primary key from the Azure portal into SAS Key field. Select Queue in designation type selection as for this demo. Then click Save to register the Service Bus in Dynamics CRM.


  1. After Service Endpoint is registered in CRM, it will be ready to use by either workflow or plugin process.

Create Workflow Activity

  1. Create workflow activity in .Net and register the workflow assembly into Dynamics CRM.

  1. Use Plugin Registration Tools to register the assembly created in above step.
  2. Create a workflow process and use Account entity in this demo.


  1. Select the triggers to start the workflow process as below.


  1. Click Set Properties to specify the message queue endpoint service that is registered previously.


  1. Save and activate the workflow process.


Creating an Azure Service Bus and the service endpoint in Dynamics CRM is a simple task and is easy to set up. However, it still requires minimum development effort to execute the service endpoint notification from the SDK.

In Part 1, we simply covered the server side implementation where change event message will be delivered to the message queue in Azure service bus. In Part 2, I will demonstrate the implementation of the queue message listener which will consume the data event from the Azure service bus. The listener process will act as core integration element to execute the message event delivered from the messaging queue.