Part 1 – Configure Business events with Service Bus Topics

In this blog post, I’ll configure the business events in D365FO with Azure Service Bus topics.

Configure Azure Service Queue

Machine generated alternative text:
Azure services 
Create a 
resource 
Virtual 
machines 
Azure Active 
Directory 
Subscriptions 
Resource 
groups 
Service Bus 
Key vaults
  • Select Service Bus or ‘Create a resource’ and find service bus.
  • For service bus, you need to create a service bus namespace, where you can add service queues and topics and manage other relevant resources. After providing the details down here, click Create.

Name -> Some meaningful unique name

Pricing tier -> Standard (minimum required for topics support) 

Subscription -> select the subscription you want to utilize here.

Location -> Your closest Azure region

  • Now in service bus namespace, add a topic.
  • Provide a meaningful name to the topic and leave the default values and create. I named it ConfirmedPOs. Once its created, Click +Subscription.
  • Add two subscriptions. Set the values as shown and for the purpose of this tutorial, leave all other values as default.
    • ConfirmedPOsExternalAPI
    • ConfirmedPOsTeams
  • On Service bus namespace, goto the shared access policies -> Root managed shared access key and copy the Primary connection string and note it down somewhere.
  • Now create an Azure Key Vault. Go to portal home page -> Create a resource -> Key Vault. Provide meaningful name, select your region, subscription and resource group and then hit Review + Create. Hit Create on the next screen.
  • Once the key vault’s deployment is finished Go to the resource, and add a secret.
  • On Create a secret screen, provide a name and copy the connection string value which you copied on step 6 here. Click create. Note down the secret Name which you’ll use while configuring business events later.
  • The azure application that was registered for service to service authentication must also be added on the KeyVault under access policies.
  • Click on + Add access policy and provide the details. Make sure to select the AAD application and click Add. Once you are back to the Access policies screen, Click Save.
  • Now Go back to overview page of the key vault and make note of DNS name.

Configure AAD app

  • Now configure AAD app for service to service authentication. Azure portal home page -> Azure active directory -> App registrations and click New registration.
  • On next screen, give it a name and click Register to create an app.
  • Next, on the app, go to Certificates & secrets -> +New client Secret give it some description and click Add.
  • Now copy the secret value and keep it safe somewhere. You wouldn’t be able to access this again once you exit out this screen.

Configure Business Events

  • Now in FinOps, navigate to System administration -> Setup -> Business events -> Business events catalog.
  • On Endpoints tab, click New. Leave the default endpoint type = Azur service bus topic and click next.
  • Add the details gathered in the earlier steps and click OK.
  • Now activate the business event.
  • Leave the Legal entity blank so that it can capture events from all companies. Press ok. Now the event is activated.
  • Now confirm a purchase order. Navigate to Accounts Payable -> All purchase orders. Select any approved purchase order and click Purchase -> confirm.
  • Now you can use Service bus explorer to receive and visualize the JSON messages received in the service topic. If you haven’t used the Service bus explorer before, here is the GitHub link with documentation.

https://github.com/paolosalvatori/ServiceBusExplorer/

  • On Service bus explorer, connect to your service bus and you’ll see the topic with two subscriptions. Right click on any subscription to receive messages from DLQ (Dead Letter Queue). The message will be received in DLQ by default. We’ll discuss it in details in subsequent parts of this series.

Now you have successfully configured Business events with the Azure service bus topic. In the next part, we’ll build an azure function to consume and process this message.

Next in this three parts series …

Part 2 – Build azure function for a topic subscription to update a third party system via an API call

Avoid point-to-point integrations nightmare by using business events and Azure based middle layer

Integrating and communicating through standardized data sets with multiple systems is an indispensable requirement in every ERP project. No business can just rely on a single system or service to comply with all business needs. Traditionally it has been seen that as the requirements arises to use additional piece of software or a service provider, the integration is built at that time to fulfill the requirements. Although it is looked into from overall enterprise architecture standpoint but often missed from integration (or Technical I should say) architecture perspective. This results in many point-to-point integrations causing lot of churn and maintenance nightmare down the road. Often times this could be avoided by utilizing a robust middle layer and following integration best practices.

In this upcoming series of posts, I am going to assume a scenario and build an integration utilizing Azure based middle layer to demonstrate the power of Azure functions and service bus and how it can work altogether with FinOps to produce a highly scalable and robust integrations by avoiding point-to-point touchpoints.

Scenario

Contoso entertainment systems have a unique requirement where they want to update a third party service provider about a posted purchase order in real-time through their web API. At the same time, they want to have an email message sent to a team’s alias.

High level approach/design

  • A Purchase order is confirmed and registered a business event.
  • A message is dropped on Service bus topic with multiple subscriptions through service bus.
  • Azure Functions will be auto-triggered and process the message as soon as the message arrives in the topic/subscription.

We’ll be building it in three parts. 

Part 1 – Configure Business events with Service Bus Topics

Part 2 – Build azure function for a topic subscription to update a third party system via an API call

Part 3 – Build azure function for a topic subscription to send an outlook email

I’ll continue to post these parts and update this post with the links in coming days. Feel free to subscribe to my blog to get first hand update.