As of CRM Online Update 1 (Spring release – see KB 2925359 Microsoft Dynamics CRM Online releases for an overview of the different release) – the recommended way of integrating Dynamics CRM Online and Azure Service Bus is using Shared Access Signature authentication.This blog post still uses ACS(Access Control Service) authentication – in a next post I will outline the differences when using SAS (Shared Access Signature) authentication.
Dynamics CRM Online is by default pre-configured for Microsoft Azure integration. You will however still need to proceed with the following steps:
- Make sure that you have the Microsoft Azure PowerShell module installed – if you have multiple subscriptions linked to your login – check out Quick tip – using Azure PowerShell with multiple subscriptions
- Create a Service Bus Namespace as outlined in Walkthrough: Configure Microsoft Azure ACS for integration with Dynamics CRM (https://msdn.microsoft.com/en-us/library/jj863635.aspx )
- Add extra configuration settings on Azure Service Bus :
- Create a service identity (issuer)
- Create a rule group and rules
- Configure the scope
- These settings can be configured in two different ways
- Follow the steps outlined in
- Use the plugin registration tool to add the extra required configuration using the (Save & Configure ACS) screen when you register a new endpoint. I will use this option since this is the simplest from a developer perspective – before you can use this screen make sure that you perform the next two steps. First you will need to download the certificate from Dynamics CRM Online – it can be found underneath Settings>Customizations>Developer resources screen https://manage.windowsazure.com since Azure Service Bus management is still in preview on the new portal) and select the connection information from the Azure Service Bus namespace that you created in the first step. Copy the default key.
In this example we are going to integrate CRM with a persistent queue and we are going to leverage the built-in Azure plugin in Dynamics CRM. Open the plugin registration tool and select Register New Service EndPoint.
You should see the screen below for registering a new service endpoint – if you get another screen you are most likely using a newer version of the CRM SDK – and you switch to the CRM 2015 SDK or the first build of the CRM 2016 SDK (December 2015 release).
Before Dynamics CRM Online can post on the queue you will need to create the queue which was specified in the path “jopx/demo”. You can write code for this or you can simply use a tool such Service Bus Explorer - https://code.msdn.microsoft.com/windowsapps/Service-Bus-Explorer-f2abca5a to create the queue (or you can create the queue from within the Azure Management Portal)
Click on Save & Configure ACS to add the necessary configuration data as outlined before. Here you will need to enter the following information:
- Fill in the management key that you copied over from the Azure Service Bus connection information
- Select the certificate file that you downloaded from your CRM Online instance
- Fill in the issuer name – crm4.dynamics.com (This information is also copied over from the Developer resources screen in Dynamics CRM)
Finally, you will need to define for which CRM entity you want to couple the event execution pipeline to the Microsoft Azure Service Bus. The native CRM Azure-aware plugin allows you to post the data that is being processed as part of the current CRM operation to the queue. It does this by transferring the information in the form of a serializable RemoteExecutionContext object. Registering the Azure-aware plugin is the same as registering any plugin for CRM. Use the plug-in registration tool and right-click on the service endpoint that you just created, then select Register New step to select the “Create” message and the “Contact” entity.
To test it out you simply create a new contact record and you should see that a new entry appears in the CRM System Jobs. After creating a new contact you should have an entry in the CRM System Jobs: Settings > System Jobs, indicating that the asynchronous plugin posting the create to Azure has been executed. You can also see the message posted on the queue in the Azure Portal.