Access Dynamics 365 through Azure API Management
A project I recently worked on required a Third-Party vendor to access Microsoft Dynamics 365 data. This external organisation wanted to query customer data and surface this data on another platform. Rather than provide direct access to Microsoft Dynamics through a User account which carried other implications, I thought it would be wiser to implement Azure API Management to provide them access to data they needed, thus keeping inline with GDPR.
The steps to setup API management are fairly straight-forward.
- Ensure Dynamics 365 and Azure are in the same tenant
- Create an API Management resource
- Create Application Secret
- Create Authentication in the API Management Service
- Test in the Azure Portal
Ensure Dynamics 365 and Azure are in the same tenant
Dynamics 365 and Azure need to be in the same tenant. The key pieces of information required are: Azure Tenant ID and Dynamics 365 Organisation ID.
Take note of both your Azure Tenant ID and Dynamics 365 Organisation ID
Create an API Management resource
In Azure, create a new API Management Resource. This is relatively straight-forward.
Create Application Secret
Login to Azure Active Directory and create a new App Registration.
The Redirect url is optional so feel free to add https://localhost
Once that is complete, create a new Client Secret by going to the Certificate & Secrets
Add a new secret
Take note of the new value: p/eLso71N9nC/2c/Goy/dY2L=Pku0Vp_
Create Authentication in the API Management Service
At this point your API management Service should be deployed. The first step is to create the authentication mechanism that will allow consumers to connect to your newly created API endpoint.
Go your newly created API Management Service, then scroll down to OAuth 2.0.
Add the authentication details as required.
Test in the Azure Portal
Once you have created your API endpoint, the settings should look something similar to:
At this point, this is all you need to create an API endpoint.