I need to trigger an azure function
on a file created in a specific folder in OneDrive
for Business. The function should output another file in another folder of the OneDrive
.
I am asking here because the Azure Docs are admittedly in need of update and improvement for Beginners.
Asked
Active
Viewed 2,343 times
1

Stoyan Atanasov
- 11
- 3
-
You could [configure and work with Microsoft Graph triggers and bindings in Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-microsoft-graph) to achieve onedrive input and output binding. – Joey Cai May 13 '19 at 08:09
-
That is the problem. The documentation is very sparse only mentioning you should create a Graph subscription and then refresh and then you can trigger on it. But there is no actual example of how to do that end-to-end and there too many open questions. For example how do I do the authentication? – Stoyan Atanasov May 13 '19 at 08:35
-
possible duplicate of this https://stackoverflow.com/questions/54621763/personal-one-drive-microsoft-graph-binding-in-azure-functions/54627660#54627660 – Anass Kartit May 13 '19 at 12:45
-
Have you reviewed Azure Logic Apps to trigger on One Drive File ? https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-onedriveforbusiness https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-onedrive – Ketan May 13 '19 at 14:23
-
@KetanChawda-MSFT Is Azure Logic Apps the "best practice" way to trigger a function on OneDrive or is it just a workaround? – Stoyan Atanasov May 14 '19 at 10:24
-
@StoyanAtanasov Functions and Logic Apps are Azure services that enable serverless workloads. Azure Functions is a serverless compute service, whereas Azure Logic Apps provides serverless workflows. You can mix and match services when you build an orchestration, calling functions from logic apps and calling logic apps from functions. Choose how to build each orchestration based on the services' capabilities or your personal preference. The following table lists some of the key differences between these services. – Ketan May 14 '19 at 14:40
-
Documentation for comparison: https://learn.microsoft.com/en-us/azure/azure-functions/functions-compare-logic-apps-ms-flow-webjobs#compare-azure-functions-and-azure-logic-apps – Ketan May 14 '19 at 14:41
1 Answers
3
Azure function did support OneDrive file Input/Output bindings, but it doesn't support the trigger.
you could use Logic App to implement it, and there is When a file is created
trigger connector just like KetanChawda mentioned with OneDrive for Business connector.
And it also support Azure Function connector, means you could add the function into the workflow if you have to use Function to finish some works.

George Chen
- 13,703
- 2
- 11
- 26
-
1That is exactly the question. Azure function **does** support trigger on Onedrive but it is done in an roundabout way - trough Microsoft Graph Subscriptions. The problem is that it is very convoluted and takes a huge amount of time. I have read the docs and am looking at someone that can give end-to-end solution with cloud functions. I have looked at Logic app but it adds another layer of complexity and setup, monitoring and support. – Stoyan Atanasov May 14 '19 at 09:32
-
@Stoyan Atanasov, looks like you could use External file trigger(preview) to do it, but no docs mention it. Here is a same answer to it.https://stackoverflow.com/a/55509155/10383250 – George Chen May 15 '19 at 02:46
-
-
I can't figure out how to connect a Logic app to a function app. It is too complicated on a first look. I have to run a ton of experiments and read a bunch of docs. The first tell that this is some workaround is that I Logic apps and function apps are separate entities and not one entity. I don't know what that means for logging, tracking and debugging but I don't feel confident with this solution right now. – Stoyan Atanasov May 22 '19 at 08:20
-
@Stoyan Atanasov, you want to integrate function with logic apps? There are officials doc about how to implement it, you need use the HTTP triggered function and here are docs link. [one link](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-azure-functions#add-existing-functions-to-logic-apps) and [two link](https://learn.microsoft.com/en-us/azure/azure-functions/functions-twitter-email). – George Chen May 22 '19 at 08:33