Microsoft Azure Logic Apps: Syncing your DropBox, OneDrive and Google Drive
Logic Apps
Logic apps is the cousin brother of BizTalk Server, technically an Orchestration or Workflow on cloud. It solves integration problems and automation of business process using API's and connectors available on the Azure Marketplace.
Dropbox
Dropbox is a file hosting service that offers cloud storage, file synchronization, private cloud and client software. A Dropbox Basic account is free and includes 2 GB of space.
OneDrive
OneDrive is a file hosting service that allows users to sync files and later access them from a web browser or mobile device. Users can share files publicly or with their contacts; publicly shared files do not require a Microsoft Account to access them. OneDrive offers 5 GB of free space to the users
Google Drive
Google Drive, formerly Google Docs, is a file storage and synchronization service created by Google. It allows users to store files in the cloud, share files, and edit documents, spreadsheets, and presentations with collaborators.
Creating Logic Apps application in Azure
Lets see how Logic Apps, API's and connector looks like :
When we visit https://portal.azure.com (Preview Portal) using our MSDN IDs we can use Microsoft Azure like below :
There are whole lot of things on Azure but lets focus on our Logic Apps.
Lets create a new Logic Apps application by clicking on the Logic Apps, it will ask for a following things :
- Name : which is giving your application an name
- Subscription : right now it is free subscription but it will expire in 30 days, otherwise you need a valid Azure subscription
- Resource group : It is basically a logical container which is used to manage various assets/resources that share the same lifecycle, permissions policies. For e.g. all resources for BizTalk could be grouped together and could be given a specific resource group name.
- Location : The location of the Data center in which your Logic apps application would get deployed and stored
After clicking CREATE a new application would get created in the All Resources like below :
After clicking on this application we go to development tools which contains Logic App Designer, API connection.
Now lets create a template for development, just go to logic app designer and select Dropbox to OneDrive template for syncing :
After creating the template we need login details of both DropBox and OneDrive and we get something like this in designer :
These two processes contain settings which needs to be done to sync files between Dropbox and OneDrive, settings that I have done are :
For Dropbox :
In Folder I have selected root '/' as I would be dropping a file directly on Dropbox not in any folder, frequency could be in minutes, hours or days.
For simplicity I have used 3 minutes
For OneDrive :
For OneDrive configuration a new folder is created in root directory with File name as same that got uploaded in Dropbox and same file content.
After doing configuration of Dropbox and OneDrive lets add Google Drive template of Create file like below :
Now we need to add a new step i.e. to create a new file on Google Drive, for that we have template in Logic Apps like below :
Now lets configure this template :
Folder Path : Created a new folder in Google Drive
File Name & File Content : Select output from Dropbox as input of Google Drive - Create file action
Now lets come to the main part of running and testing our solution. Just by clicking the save in logic apps designer will deploy the code and the code would be ready to be run and tested.
I have uploaded a new file called MyFile.txt in Dropbox, now after every 3 minutes our code would poll the path configured and pick up MyFile.txt and create a new file in both OneDrive and Google Drive on the locations specified in there respective templates :
A new file is created on OneDrive :
At the same time a new file in Google Drive is also created :
Checking logs
There are two types of logs that you could check on Logic Apps :
1. To be checked under Activity Logs :
These logs are created when you save/validate your code or when any error/warning/info is received while code is running, we can also create a custom query to check logs
2. To be checked under Overview of Logic Apps
These logs are used to check the timestamp/duration/status of the code run, also we could Run Trigger on this page and could check status of our trigger as depicted in the above picture.
Conclusion
Using Logic Apps we can integrate various cloud offerings of various vendors on the go. This article could be expanded to add custom conditions to create file in OneDrive or Google drive when you receive particular type of file or any parameters of condition.