
A data entity is an abstraction from the physical implementation of database tables. For example, in normalized tables, a lot of the data for each customer might be stored in a customer table, and then the rest might be spread across a small set of related tables. In this case, the data entity for the customer concept appears as one de-normalized view, in which each row contains all the data from the customer table and its related tables.
Synchronous integrations are relatively straightforward. Any data entity that has Is public enabled is automatically available as a service application programming interface (API) in the following URL: https://[BaseURL]/Data/<<Data Entity Public Collection Name>>.
Currently, OData protocol is used to expose endpoints where all public-enabled entities can be interacted with.
Middleware is software that different applications use to communicate with each other. It provides functionality to connect applications intelligently and efficiently so that you can innovate faster. Middleware acts as a bridge between diverse technologies, tools, and databases so that you can integrate them seamlessly into a single system. The single system then provides a unified service to its users. We use node.js.
Middleware started as a bridge between new applications and legacy systems before it gained popularity in the 1980s. Developers initially used it to integrate new programs with earlier systems without rewriting the earlier code. Middleware has become an important communication and data management tool in distributed systems.
Our middleware is the bridge between Dynamics 365 F&O and our native mobile apps.
Our mobile apps are developed using ionic. The only cross-platform mobile SDK built exclusively for the enterprise. Ionic is a complete open-source SDK for hybrid mobile app development created by Max Lynch, Ben Sperry, and Adam Bradley of Drifty Co. in 2013. The original version was released in 2013 and built on top of AngularJS and Apache Cordova.


Login on to: https://azure.microsoft.com/en-us/services/active-directory/ with Microsoft Azure account.

Navigate to App registration page

Register an application with the following information:

On successful registration, the user will be presented with the following details:

To generate the Client secret select the option on the side bar with the name: Certificates & secrets.

On the view that opens you will have three tabs available to you, select Client secrets.
Here you will need to add a new Client secret by clicking on the New client secret button.
A modal will open to the right-hand side of the page that will ask you to enter a description and select the expiry date of the secret. A longer expiry date/period is better because this Client secret is important to have on the middleware.
When the details have been filled in and the client secret is visible on the screen you should copy it before leaving the view.

The Client Secret will available only the one time. Please double check to make sure you have copied and saved the value.
If the client secret expires, users won't be able to log in to the system. Create a reminder to create a new client secret and update the environment 'Client Secret' value in the middleware frontend before the current one expires
All these details (Tenant ID, Client ID and Client secret) will be needed by the app developers to add to the configuration files of the application to enable the application to authenticate against the correct Azure instance.
Middleware, is needed for all communication between the mobile applications and Dynamics 365 F&O. The Middleware can be installed on any Internet facing Server with Node JS.
Complete the following steps to create a Azure hosted Virtual Machine.
Steps to create a new Virtual Machine:

Image: Windows server 2022 Data Center: Azure Edition – Gen 2
Size: D2s_V3 – 2 vcpus 8 GB RAM, Data Disks: 4
Inbound ports: 3389 (RDP), 80 (HTTP), 443 (HTTPS)
We Recommend the following minimum settings; OS disk type: Standard SSD & Encryption type: (Default) Encryption at-rest with a platform-managed key
Minimum Settings:
- Source type: None (empty disk)
- Size: Standard SSD LRS 32 GB
- Encryption type (Default)
Note the IP address stated under: “NIC Public IP:”
Complete the following Steps to install Internet Information Services (IIS).
Complete the following steps to install NodeJS onto the Virtual Machine:

Please compete the following steps within IIS.
Select Server Certificates from the menu:
Please compete the following steps within IIS.
As part of the setup of the Mobile Middle Ware, you need to create a new Domain Name, and Point to the new Azure Server. This setup will be different depending on your Hosting Company / Domain name Registrar.
In this example we will assume the new domain name is: middleware.YourDomain.com
The process you need to complete is:
Ping middleware.YourDomain.com
The mw.axnosis.com website will be used to “manipulate” the Dynamics Environments e.g., newgrc/newaxn, that the middleware will connect to for different apps.
When a user makes a request to the middleware, this setup will be read from to determine how to continue with the logged in user.

On the Users page you can add a list of users that are going to be using apps in your organization. Users added here should be added as the user that they will be logging into, e.g., morne.kapp@axnosis.com.
You will also be able to add Admin users if you are the super admin user.

The Apps page enables you to add a list of apps that are going to be used in your organization and that users will be logging into e.g., Incidents, Inspections.

On the URLS page, you will be able to add the dynamics endpoints that your users and apps will connect to through the middleware. You will be able to add new environments with the list of details that can be entered when a user clicks on the dropdown to see the list of inputs.
These details are very sensitive and can be found when registering your app on azure.

The Entries page enables you to combine all the data from the other pages into one entry for the middleware to read.
You will be able to set which users, using which apps, connecting to which dynamics endpoints. You can either select the 'All' option or specific values.

Some applications require non-authenticated requests. I.e., Registering a new user through the Vendor Self Service App. By specifying a D365 user with encrypted password on the middleware we can allow non-authenticated requests to be sent to the middleware and for those requests to be authenticated when it reaches the D365 endpoints.
User credentials should be provided for each environment where User Impersonation is required.
Enter the JSON setting into the environment.d365.js file which is under the /env/ folder in the middleware application folder.
Example file; available on request from please@axnosis.com
We use PM2 to manage the middleware process and the log file rotation.
Install pm2 globally
Start MiddleWare:
Check Logs:
Restart MiddleWare:
If the pm2 command does not restart an old service successfully, you should delete the service and start it from scratch:
The setup and configuration above assumes cloud setup. All the settings and configuration are cloud specific and should be completed as specified.
When using an on-premise Active Directory (ADFS) for authentication, it is not necessary to set up the App Registration as described above. The client secret is not required and can be left blank. The following settings should be used in the Environment configuration:
To prevent being locked out of your environment, it is critical to update the Client Secret before it expires.
Note that only the Client Secret field needs to be updated.
