How to setup Business Events with Azure Service Bus Queue endpoint in D365FO?
In D365FO, you can manage the destination where you want your business event to be sent to by configuring endpoints. Business events support multiple types of endpoints and in this article we are going to cover the "Azure Service Bus Queue" endpoint where I'm going to show you how to create an azure service bus from scratch and setup it up in D365FO.
In general, "Azure Service Bus" enables applications and systems to communicate with each other and exchange information. And Azure service bus queue is a type that provides a 1-1 communication between the sender and the receiver.
First, let's configure D365FO Business event with Azure service bus queue endpoint:
- Go to System Administration - Setup - Business events - Business events Catalog
- Go to "Endpoints" tab, click "New", choose "Azure service bus queue" endpoint, then click "Next"
- Configure the endpoint, by first filling the "Endpoint name" and "Endpoint description" with whatever you like
Now to fill the other values, we'll need to do the following:
- Create azure service bus namespace
- Create azure service bus queue
- Create shared access policy for the service bus
- Create key vault
- Create a secret
- Create an app registration
- Link the app registration with the key vault
Azure service bus namespace
The first step we need to do is to create an azure service bus namespace:
- Login to Azure portal https://portal.azure.com
- Click on Service bus or search for it
- Click on create
- Fill the values below in order to create a service bus namespace, then click "Review + Create" to jump to the "Review + Create" tab.
- Subscription: Choose your Azure subscription where you would like to create the service bus namespace
- Resource Group: create a new resource group or use an existing one to link your new namespace to it
- Namespace name: choose a unique name for your namespace
- Location: This is where you would like your namespace to be hosted
- Pricing tier: Choose your pricing tier. Here i chose the pricing tier as "Basic" because I'm going to create Azure service bus queue but if you are planning to use service bus topics, then you will need to choose pricing tier as "Standard" or "Premium"
- Click Create
- Once the deployment is done you can click on go to resource to see your service bus namespace
The next step is to create a service bus queue:
- Go to "Entities" in the service bus namespace, then choose "Queues", click "+ Queue" and start filling details.
Here i just filled the name and left other values with their defaults
Now let's create a "shared access policy" for the service bus, in order to allow D365FO to send business events to the service bus:
- In the service bus name space, click on "Shared access policy" under settings, then click "Add", name your policy and choose "Send" then click "Create".
- After it gets created, click on it and take note of the "primary connection string" as you will need it later to save it in the key vault secret value.
- Let's go back to Azure portal home page and search for Key Vault
- Click create
- Fill the values as per the image below in order to create a key vault, then click "Next"
It's somehow similar to how you created the service bus namespace - Choose the permission model (here I chose Role based security), then Click "Review + create" to jump to the "Review + create" tab
- Click Create
- Once the deployment is done you can click on go to resource to see your key vault homepage
- Go to "Access control (IAM)", click Add, then add role assignment
- Click on "Key Vault Administrator", then click next
- Click on "Select members", look for your user and select it, then click "select"
- Click Next
- Click "Review" + assign
If you don't have an azure app registration created, then you will need to create a new one. You can check my detailed article on how to create one How to create App Registration in Azure?
After you create it, you will need to get the "client application Id" and "secret" from the app registration to fill them in the business event configuration.
- First you need to make sure that the ClientId is defined in D365FO environment. Go to System Administration - Setup - Azure Active Directory Applications
- In order to get this clientId, sign in to https://portal.azure.com
- Go to App registrations and choose your application, where you can find the ClientId
- In order to get the client secret, click on your app, go to "Certificates & secrets" and take the secret value. Or contact your admin to give you the values
- Now we can fill the the business event setup with those values
- The next step is to link the app registration with the key vault, so that the app registration can access the key vault secret
- Go to "Access control (IAM)", click Add, then add role assignment
- Click on "Key Vault Secrets User", then click next
- Click on "Select members", look for the application registration name and select it, then click "select"
- Click Next
- Click "Review + Assign"
Comments
Post a Comment