FinOps Business Event connection with Azure APIM – Azure Function

This article is mainly focuses on connecting the Azure APIM with finance and operations business event. Whenever the business event triggers it will send the payload to Azure APIM and it forwards the payload to Azure Function / Function App.

In this article we will go through the steps to configure Function App with APIM and connect that APIM with FinOps Business Event.

  1. First we need to create Function App, for that we need to login to https://portal.azure.com/ and Select Function App.
  2. Function App is created.
  3. First open your finance and operations environment.
  4. Navigate to System administration > Setup > Business events > Business events catalog
  5. Here we are using Purchase order confirmed business event for demo purpose you can select your own business event.
  6. Click on Purchase order confirmed business event, Click on Download schema button to download payload schema.
  7. It will download the payload schema file open that file and copy its content.
  8. Go back to your Function App, click on Functions menu.
  9. Create new Function by clicking on Create button.
  10. Select Development environment as per your convenience either use Development in portal or in visual studio, its your choice.
  11. Here in this demo I am using development in portal.
  12. Select HTTP Trigger and click on Create.
  13. After creating a Function App we need to create the Azure APIM (API Management) from Azure Portal.
  14. Search for API Management services, Create new.
  15. APIM will take some time like 30 minutes something to delpoy, be patient till APIM is deployed succesfully.
  16. Click on API menu.
  17. Select Function App tile.
  18. Click on Browse and select the function app you created in this article before.
  19. Click on FinOps-BusinessEvent and then HttpTrigger1 and then Test.
  20. Copy the Request URL and Ocp-Apim-Subscription-Key and save them somewhere for future.
  21. After creating a APIM, we need to create the App Registration for authentication in Azure Portal.
  22. Copy Application (client) ID of App Registration somewhere for future.
  23. Click on Certificates & secrets menu, and add the secret.
  24. Click on New client secret button and give secret name and validity and click Add.
  25. Copy Secret Value somewhere for future.
  26. After App Registration, we need to create Key vault in Azure Portal.
  27. Copy Vault URI somewhere for future and then click on the Access policies menu.
  28. Click on Add Access Policy button.
  29. Select Key & Secret Management in Configure from template (optional)
  30. Click on None selected in Select principal, it will open pop up form enter the Application (client) ID of App Registration which you saved in point number 40. It will search the App registration select it and click on Select button.
  31. After that click on Add button.
  32. Click the Save button then to save the access policy.
  33. After saving the access policy on key vault, create Secret on Key vault. To create secret click on Secrets menu.
  34. Click on Generate/Import button.
  35. Give the appropriate name to the secret and save it somewhere for future use.
  36. The Value of secret should be <APIM endpoint URL>?subscription-key=<APIM endpoint subscription key>
  37. <APIM endpoint URL> is the value which you saved on point 36 as Request URL.
  38. <APIM endpoint subscription key> is the value which you saved on point 36 as Ocp-Apim-Subscription-Key.
  39. Click on Create button to create Secret.
  40. After saving Key vault secret go back to you FunctionApp and write code to log Purchase order number when business event is called.
  41. Go to your FinOps environment again.
  42. Navigate to System administration > Setup > Business events > Business events catalog > Endpoints
  43. Click on New button to create a new endpoint.
  44. Select endpoint type as HTTPS and click Next.
  45. Give the appropriate name and description for an endpoint.
  46. In Azure Active Directory application, paste the Application (client) ID of App Registration which you saved in point number 40.
  47. In Azure Application secret, paste the value which you saved in point number 45.
  48. In Key Vault DNS Name, paste the Vault URI which you saved in point number 50.
  49. In Key Vault Secret Name, paste the value which you saved in point number 63.
  50. After end point is configured in FinOps, go to Business event catalog tab and select the Purchase order confirmed business event and click on Activate button.
  51. Select the legal entity and the endpoint which you just created and click OK.
  52. Check in Activate business events tab that the business event is activated or not.
  53. All configurations are completed. In order to trigger the business event we need to confirm the purchase order in order to trigger the business event.
  54. Go to FinOps and navigate to Accounts payable > Purchase orders > All purchase orders
  55. Select the purchase and click Confirm button.
  56. Purchase order is confirmed. Now lets see if the payload of business event is sent to the function app via APIM or not.

We successfully passed the business event payload of FinOps to the Function app via APIM.

Thank you for reading this article hope you find it useful.

Omar Iqbal

Technical Consultant

References:

  1. https://azureintegrations.com/2020/02/10/d365fo-business-event-and-azure-function-app/
  2. https://nuxulu.com/2019-11-05-business-events-and-https-endpoint/
  3. https://dynamics365musings.com/how-to-setup-d365-business-events-part-1/
  4. https://dynamics365musings.com/how-to-setup-d365-business-event-part-2/
Total
0
Shares
7 comments
  1. Hello! This post could not be written any better!Reading through this post reminds me of my previous roommate! He always kept chatting about this. I will forward thispost to him. Fairly certain he will have a good read.Many thanks for sharing!

Comments are closed.

Previous Article

FinOps Business Event connection with Azure APIM - LogicApps

Next Article

Reserve and Unreserve salesline inventory in X++

Related Posts