Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support Teams Worldwide

Recurring Integrations in Dynamics 365 for Operations

To enqueue messages for recurring integrations in Dynamics 365 for operations, the sample app published in github is helpful. To make this file enqueue work seamlessly, few setups in azure portal and Dynamics 365 for operations need to be done before running the sample application.

Here is a step by step guide on the setup changes to be done.

Azure portal Setup

  • Go to Azure Portal > Azure Active directory > AppRegistrations

  • Click New Application Registration and select “Web app/API” for application type.
  • Enter your Ax URL for sign on URL

  • Click create and make sure to note the application ID
  • You might go back to the list of applications and you need to filter for your app
  • Click on the app and go to “Required Permissions” page

  • Click add and select “Microsoft dynamics ERP”

  • Got to select permissions tab and select all the permissions available (make sure you select each checkbox individually as select all might not work) and click Select

  • End result will be something like below

  • Go to keys, enter key description and save. Copy the value field as it won’t be displayed afterwards. This will be your client secret
  • Close azure portal

Dynamics 365 for operations Setup

  • Open Dynamics365 for operations and go to System Administration > Set up > Azure Active Directory Applications
  • Enter the client Id (Application Id from “Azure setup” section (step 4)
  • Enter name and select user from drop down (make sure user has System Administrator privileges )

Github code changes

Download the “RecurringIntegrationsApp” from github https://github.com/Microsoft/Dynamics-AX-Integration and extract the files from zip

To get this to work on your local env, please make sure you make the following setup

Go to <Path where Zip is extracted>\Dynamics-AX-Integration-master\DIXFSamples

  • Make sure below folders are created in your C:\Temp folder

  • Folder structure can be altered by modifying below parameters in the app.Config file

  • Make sure you set below parameters as per you env
    • AAD Tenant –Azure tenant value. One way to fix this out is open your application web.config file and you will find a
    • Azure client ID -The client Id copied in Azure setup (step 4)
    • Rainier URI – Dynamics Ax URL
    • Recurring job Id – Activity Id for the recurring job created in Ax
    • Entity name – Entity for which the recurring job is created

 

In the visual studio solution explorer, Go to Helpers and open AuthenticationHelper.CS > AuthorizationHeader method, if you see that code is not using Client App secret, please make below code change (comment out existing code for acquiring the token and add new code). This code should be updated in github code soon.

If you see that client App secret is already being used, please skip below code changes

 

string aadClientAppSecret = “Client Secret from Azure App registration”;

var credential = new ClientCredential(“Application Id from Azure App registration”, aadClientAppSecret);

AuthenticationResult authenticationResult = authenticationContext.AcquireTokenAsync(“Dynamics 365 for operations URL”, credential).Result;

return authenticationResult.CreateAuthorizationHeader();

Build the code and make sure there are no compiler errors

 

Enqueuing Files

Place the file to be enqueued to “C:\Temp\Input” folder

Run the github code to open “Ax7 recurring data jobs processor”

Go to settings page, you can see that all values are defaulted

Go to execution tab and Click start