Blog

Managed File Transfer and Network Solutions

How To Copy Files To Azure Blob Storage On A Predefined Schedule

Posted by John Carl Villanueva on Sat, Nov 14, 2020 @ 07:04 AM

For today's tutorial, we're going to show you how to configure JSCAPE MFT Server so that it will copy files from a local directory to Azure Blob Storage on a predefined schedule. 

Watch the video 

Would you prefer to watch a video version of this tutorial instead? You can play the video below. Otherwise, just skip it if you wish to continue reading.

 

 

Many of the steps needed here are very similar to the ones we used in the blog post 'How to Mirror an FTP Server to S3 Storage', so we won't be discussing every single step in detail anymore. If you want additional information, I suggest you click that link and leave that post open on a separate tab for reference. 

Alright, let's proceed. What I have here is a local directory named 'syncdir' in the C: drive of my server. This will serve as my source directory. So, basically, once we're done, all new files found in this directory will be copied to an Azure Blob container every time the clock strikes a particular time.  

 

[on my JSCAPE MFT Server instance]

 

how to copy files to azure blob storage - local directory

 

Speaking of which ...

 

[on my Azure Blob Storage container]

This right here is my Azure Blob storage container named 'jcpv-test'.

 

how to copy files to azure blob storage - blob container

 

Let just add a new directory here. Let's call it 'folder1'. This is where the files in the 'syncdir' directory will be copied to. 

 

how to copy files to azure blob storage - create new virtual directory

 

 

how to copy files to azure blob storage - new virtual directory

 

Now that we have the source and destination directories set up, let's now head back to our JSCAPE MFT Server instance and start configuring our trading partner objects and the trigger responsible for copying the files in question. 

The great thing about using JSCAPE MFT Server for this purpose is that, MFT Server can serve as THE single solution for all your file transfer needs. It supports a wide range of file transfer protocols and can even facilitate file transfers to, from, and between hosts with no file transfer service. 

Here are a couple more examples that showcase what you can do with JSCAPE MFT Server. You can read these later. 

How To Sync A Windows Folder (on a host with no file transfer service) With An AWS S3 Bucket

How to Set Up Automated AS2 File Transfers

How To Copy Data From Azure To AWS S3

 

how to copy files to azure blob storage - services

 

In the meantime, let's proceed with the next part of this tutorial. 

Before you can start copying files from your local directory to Azure Blob Storage, you'll need to create two trading partner objects first. 

The first trading partner object should represent your local directory and hence should be of type 'Local Directory'.

 

how to copy files to azure blob storage - local trading partner

 

The 2nd trading partner, on the other hand, should represent your Azure Blob Storage container folder and, hence, should be of type 'Microsoft Azure Blob Service'. 

I'm going to assume you already know how to create these trading partner objects. If you don't, you may read these posts for reference:

How to Mirror a FTP Server to S3 Storage

How To Upload Files To Azure Blob Storage Via FTP/S

 

how to copy files to azure blob storage - azure blob storage trading partner

 

Assuming you already have your trading partners ready, the last step is to create a trigger that would copy files from one trading partner object to the other.

Go to the Triggers module and click the Add button to add a new trigger. 

 

how to copy files to azure blob storage - add new trigger

 

For those who are using JSCAPE MFT Server version 12.1 and higher, you'll be presented with a Trigger Template dialog where you can choose a template that best describes the workflow you're about to automate. Let's just leave that blank and click OK

 

how to copy files to azure blob storage - trigger template

 

Give the trigger a name, for example 'copy from local to azure blob storage', and then select the Current Time event type. You may select any event type that suits your needs but, for this example, I'd like this trigger to run at a certain time of the day. That's why I'm using the Current Time event type. 

Click Next to proceed.

 

how to copy files to azure blob storage - trigger event type

 

In the next screen, you can use the Expression Builder to build an expression that would define the schedule when this particular trigger should fire. I want this trigger to execute at 7:05 AM everyday, so I built the expression as shown on the screen. 

Recommended read: Introducing the New Trigger Conditions Expression Builder

Click Next to proceed.

 

how to copy files to azure blob storage - trigger condition time schedule

 

Once you get to the next screen, click the Add button to add a new trigger action and then select Trading Partner Synchronization from the Action drop-down list and then click OK.

 

how to copy files to azure blob storage - trading partner synchronization action

 

Let me now walk you through the key settings for this Trading Partner Synchronization action. 

The first ones you'll encounter are PartnerA and PartnerB. PartnerA is basically the source. It's the trading partner from which the target trading partner will be copying from. So, in our case, that would be the Local Directory trading partner. 

PartnerB, on the other hand, is the target. It's the trading partner to which the source trading partner will be copying to. In our case, that would be the Azure Blob Storage trading partner. 

Next up are PathA and PathB. PathA is the absolute local directory path in PartnerA which PathB will be copying from, and PathB is the relative path on PartnerB that PathA will be mirroring to.

So, PathA is C:\syncdir and PathB is 'jcpv-test/folder1', wherein 'jcpv-test' is the blob container and 'folder1' is the folder we added to that blob container.

 

how to copy files to azure blob storage - action parameters 1

 

The next setting we need to specify is the Copy Condition. This is the condition JSCAPE MFT Server will use to determine whether to commence copying (or synchronizing) files each time the predefined schedule of this trigger is up.

If you select:

  • different time, JSCAPE MFT Server will commence copying if it sees that file timestamps on A are different from the ones on B;
  • different size, JSCAPE MFT Server will commence copying if it sees that file sizes on A are different from the ones on B;
  • different content, JSCAPE MFT Server will commence copying if it sees that the content in A is different from the content in B

Let's just choose different time for now. 

Another setting you need to specify is the Synchronization Mode. There are four options:

  • mirror - New and modified files from A are copied to B; redundant files in B will be deleted;
  • synchronize - New and modified files from both paths are copied to each other
  • backup - All files from A are copied to B
  • contribute - New and modified files from A are copied to B

Based on the descriptions given and your particular use case, you'll likely have to choose between backup and contribute. I'm going to choose contribute, so my trigger is only going to transfer files from A that are new new and/or modified.

Lastly, you need to specify the Result Directory. This is where the results of the copying process will be written to. 

 

how to copy files to azure blob storage - action parameters 2

 

Click OK and then drag an arrow from the Start output of the Workflow node to the Trading Partner Synchronization Action node. 

Recommended read: Introducing the Redesigned Trigger Action Workflow

Click OK to finalize the trigger creation process. 

 

how to copy files to azure blob storage - action join

 

how to copy files to azure blob storage - new trigger

 

That's it. Now you know how to configure JSCAPE MFT Server so that you can copy data from Azure Blob Storage on a predefined schedule. 

Try this yourself

Would you like to try this yourself? Download the FREE, fully-functional Starter Edition of JSCAPE MFT Server now. 

Download JSCAPE MFT Server

 

 

Topics: JSCAPE MFT Server, Managed File Transfer, Cloud Computing, Tutorials, Triggers