D365FO business event integration with Azure Function App

This blog describes a method to use Azure Integration with Dynamics 365 FO Business Events. The Dynamics 365 FO Business Events can send events/trigger/notifications to external applications such as Azure Integrations, which can use this trigger to handle specific integration or business process scenarios.
The Events that existed in Finance and Operations were previously confined to use within Finance and Operations. The new capability provides a framework that will allow business processes in Finance and Operations to capture business events as business processes are executed and send the events to an external system or application.

More about the business events can be found here

Business events provide a perfect integration scenario when an event occurs in D365FO and requires this information to be passed on to Third Party systems.

These business events can be used by

  • Azure Service Bus
  • Azure Logic Apps
  • Microsoft Power Automate
  • Azure Functions
  • HTTPS Trigger

Since these events happen in the context of business processes, they are called business events that enable business process integration.
External business processes will subscribe to specific business events from Finance and Operations to get notified when they occur. The business events can also be consumed as “triggers” in the Finance and Operations connector.

Trigger an azure function from D365FO

Use case: Trigger an azure function from the D365FO business event. Then azure function process the messages forwards the message to third-party applications and updates the status to D365FO.
At a high level what I am trying to achieve is shown below. A custom business event will be created to trigger an azure function to forward the trigger to a Third-party application.

Dynamics 365 FInOps (D365FO) business event integration with the third-party application using Azure Function App, Logic Apps, APIM, and WebAPIs.

Register an Azure AD application for KeyVault access

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Register Azure AD Application
  1. Sign in to Azure portal: https://portal.azure.com
  2. Go to Azure Active Directory Tab
  3. Click on App registrations
  4. Click on New Registration
D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Select Application ID
  1. Enter any name, select Accounts in this organizational directory only (Default Directory only – Single tenant), and The Redirect URL is not needed.
  2. Then click the Register button
  3. Open the “Overview” tab and copy the Application ID
D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Generate New Client Secret
  1. Click on “Certificates & secrets” under the Manage menu (left) and add a new client secret
  2. Copy the secret key and store it securely

Create or use existing Azure Key Vault to store Azure Function URL

If the Key vault doesn’t exist then create a new Key Vault. The steps to create a new KeyVault have been described here. Open the Keyvault “Overview” tab and copy the DNS Name URL. It will look like this:https://{keyvault-name}.vault.azure.net/

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Register Azure AD Application

Then Go to “Secrets” under the Settings menu (left), and click on “Generate/Import”.
Choose any name for the Secret e.g. d365fo-azurefun-PostData-dev
Then insert the URL from the Functions app which is used for third party integration
in the “Value” field.
Leave the other fields as it is, and just make sure Enabled = Yes.
Then click Create

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Add Keyvault access policy
  1. Then Go to the “Access Policies” under the Settings menu
  2. Click on “Add Access Policy“.
  3. In the “Select principal” field, select the Azure AD application you just created. (enter the application id in the search box)
  4. In the “Secret permissions” drop-down, select only Get and List. Leave all others blank.
  5. Click Ok
  6. Then make sure to click SAVE back in the access policies window after adding the policy.


You should see the Azure AD application under the Application access policy group, with the Secret Permissions setting.
This concludes the setups which are needed to be done on the Azure.

Configure the Business Events in FinOps

We need to configure the business event in D365FO to connect to Azure Function App.

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Business event catalog

Log In to Finance and Operations environment with an admin account, then go to System administration > Setup > Business events > Business events catalog

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Configure new end point

Then click on “Endpoints”, and click on add New. Then Select “HTTPS” from the list and then click Next

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Configure new HTTPS endpoint

Enter the following information
Endpoint name: Logical name for the endpoint
Azure Active Directory application ID: Application id/client id of the Azure Application which was registered in Azure AD.
Azure application secret: Secret created for the Azure AD Application which was registered in Azure AD.
Key Vault DNS name: the URL of the Key vault e.g. https://{keyvault-name}.vault.azure.net/
Key Vault secret name: Name of the secret where azure function URL is stored.
Then click Ok.

Now we have to activate this endpoint for a business event.

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Activate the endpoint

Go to the Business event catalog Tab, select the required business event from the catalog, then click activate. Then select the Legal entity and endpoint name and click OK.


Assuming everything was done correctly, you should see the confirmation:

D365FO business event integration with  Azure Function App, Logic Apps, APIM, and WebAPIs : Endpoint enabled

This would trigger the Azure Function during any purchase order confirmations. The HTTPS approach makes it flexible to replace the endpoint with any applications such as Logic App, APIM, Web API, WebHook, etc. The only action needed is to change the secret in KeyVault and no changes are required in D365FO.

Published by Poojith Jain

Poojith Jain is an Azure Architect with good experience with software design and development. He has a thorough knowledge of Azure Integration and he is passionate about solving complex and challenging problems in the field of Azure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: