Expose Microsoft Dataverse data to Azure Service Bus

Completed

Microsoft Dataverse provides a variety of pre-built mechanisms for externalizing its data for integration purposes. This lesson covers how to accomplish exposing Dataverse data to Azure Service Bus by using Dataverse's Service Endpoint Registration feature, which is found in its Plug-in Registration Tool.

Set up your Azure Service Bus environment

Create your Azure Service Bus namespace and message queue with the following steps.

  1. Sign in to the Azure portal.

  2. In the left navigation pane of the portal, select + Create a resource, select Integration, and then select Service Bus.

    Screenshot of + Create a resource, Integration and Service Bus options.

  3. Enter the appropriate details for your namespace and then select Create.

    Screenshot of appropriate details for namespace and Create button.

  4. Select Create.

    It might take a few minutes for your resource to provision. When it's finished, you should see something similar to the following image in the Notifications area of your Azure portal:

    Screenshot of Notifications area with Deployment succeeded message.

  5. After your resource has been created, go to your newly created namespace to create a new queue.

    Screenshot of the Create new queue process.

  6. Note a few items that are found in your namespace so that Dataverse has the correct credentials to connect to your new queue. For this procedure, use the existing Shared access policy that was auto created as part of your namespace. If you want further access limitations, you can create a Shared access policy for your individual queue as well.

    Screenshot of Shared access policies and policy details.

  7. From within your Shared access policy, copy your Primary Connection String and store it for future use because you'll need this string as part of your Service Bus Endpoint configuration in Dataverse:

    Screenshot of the copy to clipboard button.

Register Service Bus Endpoint in Dataverse

Now that you have set up a message queue in Azure, you can provide Dataverse with the required configuration information to access it.

Note

You will be using Dataverse's Plug-in Registration Tool to configure the publishing of your Dataverse data to your Service Bus. This tool is provided as part of Microsoft's Dataverse developer tooling, which is found at NuGet. For more information on how to install the Plug-in Registration Tool through NuGet, see Download tools from NuGet.

  1. Open the Plug-in Registration Tool and connect to your Dataverse environment.

  2. When connected to the environment, register your Service Bus Endpoint by selecting Register and then selecting Register New Service Endpoint.

    Screenshot of Register and Register New Service Endpoint values.

  3. Copy and paste the Primary Connection String value that you referenced earlier when setting up your Service Bus instance, and then select Next.

    Screenshot of the primary connection string value.

  4. All the fields from your connection string should prepopulate on the form. For this example, you'll be writing a one-way queue publisher, so you can leave the Designation Type as Queue. Dataverse supports many other designation types to support various messaging protocols.

    Enter your queue name into the Queue Name field and specify Message Format as JSON. Dataverse supports the .NETBinary, JSON, and XML message formats. You are using JSON for this message because it's become an industry standard messaging format because of its portability and lightweight nature. Lastly, to have your user information sent to your queue, you can select UserId in the User Information Sent drop-down list.

    Screenshot of the service endpoint registration details.

Register a Service Bus integration step

In this scenario, you'll register an integration step that publishes a message to a Service Bus queue every time an account is created. By registering a step, you can define the entity and message combination, and you can define what conditions will cause the message that is being processed by Dataverse to be sent on the Service Bus to the Azure queue.

  1. Register a new step for your Service Endpoint by right-clicking and selecting Register New Step.

  2. Enter the following details to register a new integration step that will be started on creation of an account record. Make sure that you clear the Delete AsyncOperation if StatusCode = Successful flag. Clearing this flag is only for testing purposes so you can verify that the created System Job records show that the Service Bus integration step has successfully started on creation of an account record. In a real-world production scenario, we recommend that you leave this value selected.

    Screenshot of the register new step details.

Test your Service Bus integration

Test your Service Bus integration with the following steps:

  1. To test your Service Bus integration, go to your Dataverse environment and create an account.

  2. To see if the integration ran, go to Settings > Advanced Settings and select the System Jobs view.

    Screenshot of the Settings > Advanced settings area.

  3. Go to the System Jobs view by going to Settings > System Jobs.

    Screenshot of Settings > Settings > System Jobs.

  4. Verify that your integration step ran successfully by viewing it in the System Jobs view. If it ran successfully, the Status Reason should be Succeeded. You'll also use this view to troubleshoot integration runs in the event that an error occurs. In the case of failure, open the System Job record to view the error information.

    Screenshot of the integration step succeeded in the System Jobs.

  5. Because the integration step ran successfully, you can now verify that the account creation message has arrived in your Service Bus queue by going to the queue in the Azure portal.

    Screenshot of the account creation message in Service Bus queue.