Azure Service Bus : Using Power Automate to Send Messages from Dataverse

With limitations in Dataverse for long-running code, some of the logic could be outsourced to Azure.

Let's say the accounts created in Dataverse also needs to be sent to 3rd party web applications, it is possible to make direct API calls and create these records in the web applications or one of the other ways is to send the message to the service bus and from there, either a web job or an azure function could pick the message and create those records in other applications, this prevents the plugin from doing all the heavy lifting work. Service bus helps in decoupling applications from each other.

There are numerous ways to send messages from Dataverse to service bus queues.
It could be a c# code that sends the message or service endpoint registrations etc.
Azure aware plugin
Register service endpoint
In this article let's see how we could use power automate cloud flow to send the message to the Azure service bus queue when an account is created in Dataverse

Setting up the Azure account

To set up your Azure service bus in the Azure portal go to portal.azure.com
search for azure service bus, this would need us to create the service bus namespace first.

After creating the service bus namespace, we can create the queue

sample queue

Now, this completes the service bus queue setup.

Sending messages to service bus queue from Power Automate cloud flow

In the power automate cloud flow select the dataverse trigger 'When a row is added, modified or deleted'

Create a compose action to add the fields that we would want to send to the service bus

The next step is to add the service bus action

Look for the access key, which can be fetched from the azure portal under the service bus namespace, click on the Share access policies and RootManageSharedAccesskey and copy the primary connection string.

This completes the flow creation process.

To test this, create an account in the dataverse and see the flow execution, if its successful, go to the azure portal and in the queue select service bus explorer and look for the peek message option, you will be able to see the message

This is a simple example of how messages from Dataverse could be sent to the Azure service bus. This message can then be consumed by other applications
Update records in Dataverse using azure functions