D365 CRM: Call Azure Function from Dynamics CRM using Plugin Webhook



  • D365 CRM has the feature to call an Azure Function app as a plugin step triggered in a target event of an entity record, for example in the create of an account record. To archive this you need to develop in Visual Studio a project of type Function App an create a Http Trigger Get function in this project with the following code to read the request of CRM:
     


    This simple code will get the request body as a string that you can parse in a JSON object. You can use RemoteExecutionContext class to actually get all the contextual information into the Function app and then use it further.
    Once ready your code, Publish in Azure.
    Open Plugin Registration Tool to register the new Webhook:
     


    Enter the Webhook details. Select Authentication type as WebhookKey:

     

    To get the URL and the key, go to the Function App deployed in portal and look </> Get function URL to copy the function URL:

     

    The key will be the value after code= in the URL. Paste it in the Webhook and Save.
     
    Then create a New Step inside of the Webhook in a target event of the entity (for example in the Create of account) and test it.
     
    You can check the log of the function to see the request body that CRM sent to the Function App:
     
    And with this, you can call Azure Function using Plugins with D365 CRM.

    Enjoy it!


  • Comments



Add a Comment