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
- Navigate to Azure portal – https://portal.azure.com/ and select Service Bus.
- 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
One thought on “Part 1 – Configure Business events with Service Bus Topics”
Comments are closed.