Configure D365 fo and event grid
Overview on how to publish data entity changes from Dynamics Finance and Operations to Azure Event Grid.
Step 1
In D365FO, Navigate to the Business Events Catalogue page
Step 2
Navigate to the endpoints tab and select ‘Azure Event Grid’
Step 3
In Azure, create an application service registration
Take note of the Application Id and the Secret Id
Step 4
In Azure, create an Azure Event Grid Topic
https://customers.westus2-1.eventgrid.azure.net/api/events
Copy the Access Key
Step 5
In Azure, create an Azure Key Vault with a key called
key-eventgrid-topic-d365fo-customers
The secret value is the Access Key for the Event Grid Topic
Step 6
On the key vault – grant access to the secret for the Application Registration
Step 7
In D365FO ‘configure an endpoint’ and enter the Azure Event Grid Topic endpoint
It now requires the Application Id & Application secret + the key vault name + name of secret in key vault (to get the Access Key)
Step 8
An endpoint should now display
Step 9
Activate the following 2 business events
- BusinessEventsAlertEvent
- BusinessEventsDueDateAlertEvent
select your newly created endpoint
Step 10
From the customers list, create a custom alert
Configure the alert to happen when the record is created, deleted or a field changes
Ensure ‘Send Externally’ is true
Step 11
Edit the customer and change the field with the alert on it & save the record
Step 12
view an alert & business event arrives in the following table
https://XXXXX.dynamics.com/Default.htm?mi=SysTableBrowser&cmp=YYYY&tablename=eventcud
XXXXX == your organisations URL
YYYY == your company
if no record appears here – you might need to fix your batch jobs
Step 13
Verify that your Azure Event Grid Topic has received the customer change events
Step 14
The below payload structure is sent to Event Grid
Subscribing to published Events in Flow
Sample extract (which was pushed to teams)
- ID = BULK-002
- Event = LocationChanged
- Payload = {“BusinessEventId”:”BusinessEventsAlertEvent”,”ControlNumber”:5637145330,”Email”:”Chris.McKelt@xxx.com.au”,”EventId”:”D60A8657-E87C-43A8-8D7D-826EBF0490D7”,”EventTime”:”/Date(1570769681000)/”,”FieldId”:3,”Link”:””,”MajorVersion”:0,”Message”:”LocationChanged”,”MessageDetails”:”View Location: BULK-002, 24”,”MinorVersion”:0,”ParentTableId”:8565,”RuleId”:”000428”,”Subject”:”LocationChanged”,”TableId”:8565,”TypeTrigger”:”FieldChanged”,”UserId”:”Chris.McKelt”}
Key Points for setting up change alerts in D365 FO
- Alerts should be setup under 1 user with admin permissions (on test this is the dual write user)
- Setup a Batch Group called INT (integration) and allocate servers to it
- Ensure the Batch Job is setup as below (note the user)
Exported Logic App / Flow Example to listen to events and send to Teams channel
Published: