Considerations on using Microsoft Flow or Logic Apps to sync documents

|  Posted: January 24, 2017  |  Categories: Microsoft Azure

Integration will be different for us with new tools to build solutions. Microsoft Azure provides us with services like Logic Apps, Flow, Functions and Power Apps. Some are intended for power users, others for developers. Logic Apps and Functions fall under the umbrella of developer type services, which can be built in a browser or Visual Studio. Power Apps and Microsoft Flow are limited to the browser only, hence are targeted for power users or business users if you like. And if you look how Microsoft positions these technologies then the picture below says it all.

Micorosft-Business-Applications-Platforms-and-Intelligence

The question will come to mind towards when do I use Microsoft Flow and when will a Logic App be a better fit for purpose. The picture above shows how Microsoft positions Flow and Logic Apps (Pro Integration level). However, which technology fits what use case will be discussed in this article using a scenario to move documents from OneDrive to Google Drive.

Scenario

To showcase the Microsoft Flow and Logic App, we will use the following scenario. Both technologies can support this scenario. Moreover, there is no difference in functionality or behavior only in how to implement the integration solution.

Scenario

The above diagram shows how a document that is created (uploaded) in a folder on OneDrive will be picked up (copied) by Microsoft Flow or a Logic App, which is configured to poll the OneDrive folder to see if new documents are available, copy it over to a folder on Google Drive and send an email from Outlook.com to a Gmail account. In the real world, enterprises could share documents this way if they do not use the same service for storing documents (OneDrive versus Google Drive).

Microsoft Flow

Before we dive into how to setup our scenario with Microsoft Flow, let’s first explain what it is. This technology has been made General Available (GA) in Q4 of 2016 — a couple of months now. It helps you work smarter by automating workflows across your apps and services by either using over a hundred predefined templates or creating your own. Microsoft Flow can be built using a Visual Designer in a browser and you can build pretty advanced flows through multiple steps, looping, branching conditions and large set of connectors. The created Flows can be run in a default environment (Office365), Android Phone, iPhone or interact with on premise data; refer Flow documentation.

Building a Flow

To build a Flow, we need to login through https://flow.microsoft.com/en-us/. In Microsoft Flow, you can select Create from template and choose the one below.Building-a-FlowWhen we click “Use this template”, we have to setup connectivity with OneDrive and Google Drive before we can proceed.Use-Flow-TemplateNext, click continue to start configuring our flow. We specify in the OneDrive connector which folder we will be listening to. Subsequently, in the Google Drive connector, we specify what folder we like to copy the file from OneDrive to, what name it will have (same as file name in OneDrive) and what content (the same as the file in OneDrive). The final step will be adding another connector (Outlook) to send an email to a given email address, with a subject and body (see picture below).Flow-SettingEach minute the Flow will check if a new file has been created in OneDrive. If that’s the case the file will be copied to Google Drive and an email be sent.
Email-notification

In Microsoft Flow, we can verify that a run has succeeded.

Flow-RunsSubsequently we can click on the Run button and verify if all steps have been completed.

Verify-Flow

Logic Apps

Logic Apps have been around since last quarter of 2016 when it became general available, almost at the same time as Flow. A Logic App is a hosted piece of integration logic in Microsoft Azure. To be more precise, the hosting is done in Azure in a similar way as a Web App and the logic is built by creating a trigger followed by a series of actions similar to a workflow. And you can simply create them in a browser (Visual Designer) or Visual Studio. More on Logic Apps can be read on Microsoft Docs: What are Logic Apps.

Building a Logic App

Creating a Logic App is very straight forward. In Azure Portal, you can go to the market place, search for Logic App, select it, specify the details like shown in the picture below and hit create.

Create-Logic-App

Next step is to select a predefined template or blank. To support our scenario, we choose the blank template. The first step is to define a trigger, which will be OneDrive when a file is created. In the trigger, we need to create the connection to OneDrive and to specify the folder to listen to based on a configurable frequency.Define-Logic-App

The second step will be adding an action that will copy the file from OneDrive folder (EnterpriseA) to Google Drive. The first step in that action will be again creating the connection, followed by specifying the folder the document has to be copied to, the file name (the same as the one that was created in OneDrive) and the content (again the same as the one that was created in OneDrive).One-Drive-to-Google-Drive

The final step will be sending a notification through Outlook.com, which means creating a connection to Outlook.com (authorizing through a given email account), specify to which email address, the subject and the body.

Trigger-notification-through-Outlook

The Logic App definition is ready and can be saved. Once a document appears in the EnterpriseA folder in OneDrive the file will be copied over to Google Drive Enterprise folder and an email be sent to the given email address.

Email-notification

The run of the Logic App can be monitored in the Azure Portal, by selecting the Logic App MoveDoc in our scenario and select a run, and inspect the actions.

Logic-App-Run

Choices

Power Apps and Microsoft Flow are the tools for business- or power users for building business applications in Office365 environment. Both are fully metadata-driven and extensible so you can connect to any of your own services, third party API’s or even Functions. And through the on premise data gateway you can consume your on premise systems and applications.

Logic Apps and Functions are tools for developers and IT-pros for building more mission critical applications. Both are extensible by code, and connection to custom API’s. And through the Enterprise Integration Pack, Logic App Adapter in BizTalk Server 2016, or Service Bus you can interact with on premise systems and applications.

Microsoft Flow and Logic Apps are both so called configuration first integration services and are easy to use in a browser. Both have the same workflow designer; however, Flow is built on top of Logic Apps, which means one abstraction level higher. Yet both can use the same set of connectors.

The following table can be helpful to determine when to choose Microsoft Flow or Logic Apps.

  Microsoft Flow Logic App
Who? Business/Power Users Developers/IT pros
When? Self-service Mission critical
Tooling Browser Browser/Visual Studio 2015
DevOps Ad-hoc Source control, testing, support, and automation and manageability with Azure Resource Management
Manage https://flow.microsoft.com https://portal.azure.com
Security Standard practices; data sovereignty, encryption at rest for sensitive data, etc. Security assurance of Azure: Azure Security, Security Center, audit logs, and more

Source: Flow vs. Logic Apps Microsoft Docs.

Considerations

In the previous paragraph, we talked about the choice between Microsoft Flow or Logic App. Yet there are the following aspects to take into account:

  • Security
  • Costs

Security

Is the information in the documents in this case sensitive? Who has access to the folders? This is in general the governance that has less to do with the Flow or Logic App, yet an aspect that does matter when building such a solution.

Costs

Another aspect you have to look at is the cost aspect. Pricing for Microsoft Flow is different than for Logic Apps. Based on our scenario, you can see the difference below.

Logic App Flow
12 € per month 15 € per month

The rationale for the difference is as follows – Logic Apps run in a consumption plan and are priced per action execution. Suppose our Logic App for synchronization runs 30 days and polls each 5 minutes than pricing would be:

12 (1 poll / 5 min) x 1 (60 min/ hr) x 24 (24 hrs / day) x 30 (30 day/month) x 1 document (on average) x 2 actions = 17,280 billable actions.

17,280 billable actions x 0,0007-Euro cent will be about 12 Euro’s.

See Logic App Pricing: https://azure.microsoft.com/en-us/pricing/details/logic-apps/

The same calculation for Microsoft Flow would be based on the number of documents i.e. 8640 per month. This means that you’ll have 8640 executions for the Flow, which require a subscription of 15 Euro’s a month. However, the correct plan would be the driver for your flows, see pricing https://flow.microsoft.com/en-us/pricing/.

Power- or business users can be tempted to build Flows at a large scale and before you know it there will be tons of Flows in your enterprise. And it will be no surprise that some may overlap or have similar functionality. And with the number of Flows growing uncontrolled, the costs may increase as with maintaining them. To mitigate this potential risk, some form or process of governance will have to be in place. The same accounts for Logic Apps.

Conclusion

Hopefully this article has explained both technologies and provided insight how they can be setup, build and run. As explained in the Choices paragraph, there is a clear distinction to when to use which technology. In general, the use case should be the driver for the correct solution. Easy tasks can be automated using Flow, or developers can create new Logic Apps that can empower business users even more with extensive set of templates. Logic App and Microsoft Flow both further evolve integration and lower the barrier for building new solutions fast.

Serverless360 is a one platform tool to operate, manage and monitor Azure Serverless components. It provides efficient tooling that is not and likely to be not available in Azure Portal. Try Serverless360 free for 30 days!

Free-Trial

Author: Steef-Jan Wiggers

Steef-Jan Wiggers is Azure Technology Consultant at Codit, is all in on Microsoft Azure, IoT, Integration, and Data Science. He has almost 20 years’ experience in a wide variety of scenarios such as custom .NET solution development, overseeing large enterprise integrations, designing and building API's and cloud solutions, managing projects, experimenting with data, SQL Server database administration, and consulting. Steef-Jan loves challenges in the Microsoft playing field combining it with his domain knowledge in energy, utility, banking, insurance, healthcare, agriculture, (local) government, bio-sciences, retail, travel, and logistics. He is very active in the community as a blogger, book author, InfoQ editor, and global public speaker. For these efforts, Microsoft has recognised him as a Microsoft MVP for the past nine years. Steef-Jan's can be found on twitter at @SteefJan.