Logic Apps with On-Premise Dynamics 365
Summary
In this post I’ll explain how to connect to a Microsoft Dynamics 365 on-premise environment with Azure Logic Apps.
Three key items are required:
- Azure Subscription
- Installation of the on-premise gateway
- Firewall rules for inbound/outbound configured correctly
Assuming all the above have been configured/installed, here are the steps:
Select HTTP with Azure AD activity. The Action here is Invoke an HTTP request. For simplicity, I have selected my trigger as scheduled recurrence.

Next select the Connect via on-premise data gateway. This should be available if it was installed correctly.

Complete the fields as required. The Base Resource URL is the Web API URL

The final screen should look as follows:

The code behind the Logic Apps activity.
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Invoke_an_HTTP_request": {
"inputs": {
"body": {
"method": "GET",
"url": "http://winserver2016a/eax360Sit/api/data/v9.0/accounts"
},
"host": {
"connection": {
"name": "@parameters('$connections')['webcontents']['connectionId']"
}
},
"method": "post",
"path": "/codeless/InvokeHttp"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"Recurrence": {
"recurrence": {
"frequency": "Minute",
"interval": 3
},
"type": "Recurrence"
}
}
},
"parameters": {
"$connections": {
"value": {
"webcontents": {
"connectionId": "/subscriptions/600c20c7-54ee-4817-8cc1-b1d6782ffaaf/resourceGroups/PROD-LogicApps-Integration/providers/Microsoft.Web/connections/webcontents",
"connectionName": "webcontents",
"id": "/subscriptions/600c20c7-54ee-4817-8cc1-b1d6782ffaaf/providers/Microsoft.Web/locations/uksouth/managedApis/webcontents"
}
}
}
}
}
Running the Logic Apps should now give you a successful result.

You can now use the result for other business logic. Here I am routing data from an on-premise Dynamics 365 to an Dynamics 365 CE online environment.

Logic Apps does not have NTLM support, so you can’t make HTTP requests using the HTTP activity to Dynamics 365 on-premise. However using the data gateway makes consuming CRM data possible.
At the time of writing, I wasn’t able to research a way to trigger based on a data gateway activity.
Hope this helps.