How To Automatically Transfer Files From SFTP To Azure Blob Storage Via Network Storage
A step by step tutorial illustrating how to automatically transfer files from SFTP to Azure Blob Storage using JSCAPE MFT Server network storage objects
Let's say you have trading partners who can only transfer files to you via SFTP. Incidentally, you also happen to have an account on Azure Blob Storage and you prefer to store those files there. You're probably thinking: How can I automatically copy files from my SFTP server to Azure Blob Storage? That's easy if you're using JSCAPE MFT Server.
There are a couple of ways of doing this using JSCAPE MFT Server and I'm going to show you two of them. In the first method, which I'm going to demonstrate in this post, I'm going to assume you want all your SFTP file uploads from the trading partners in question to be transferred directly to the Azure Blob Storage folder upon upload.
Would you prefer to watch a video showing how to automatically transfer files from SFTP to Azure Blob via network storage? If so, you may play the video below. Otherwise, just continue reading.
Getting Started
First we'll need to set up a network storage object for that Azure Blob Storage folder and a virtual path that maps to that network storage. From your trading partners' point of view, that virtual path will appear just like a regular folder when, in fact, it actually maps to the Azure Blob Storage folder.
Before we head to our JSCAPE MFT Server manager, let me first show you what I have on Azure Blob Storage. So, I have an Azure blob named 'jcpv-test' and, inside it, a folder named 'folder1'. That's where I'm going to store all the SFTP file uploads.
Ok. Let's now head over to our JSCAPE MFT Server instance and login to the JSCAPE MFT Server manager. Notice that, in my Services module, I already have an SFTP service running. We need that service because that's what our trading partners will be using to upload files to us.
With our SFTP service ready, we now proceed to our Network Storage module. Click Add to add a new network storage object.
Next, select Microsoft Azure Blob Service and then click OK.
We now need to enter the parameters for this network storage object. Start by entering the name. This will be used to identify this network storage on this JSCAPE MFT Server instance. In my case, I'll just enter ns-azure blob.
Next, enter your Azure storage account name as well as its corresponding access key.
You'll also need to enter the remote directory on your Azure Blob Storage. In our case, if you recall, we have a folder named 'folder1' inside the Azure Blob named 'jcpv-test'. So, we just enter 'jcpv-test/folder1'.
We can then click the Test Server button to test our connection. If there's a problem, you'll get a message box describing it. So, for example, I'm getting a message that says 'The account being accessed does not support HTTP'. That usually means that we need to configure this network storage object to use SSL/TLS.
To do that, just scroll back up and tick the Use SSL check box.
Let's click that Test Server button again. If all goes well, you should see a message saying the 'Network Storage test passed'.
And once you click the OK button in the parameters dialog, you'll be brought back to the main screen, where you should see your newly created Azure Blob network storage object.
Now that we have our network storage object ready, the next step is to map this network storage with a virtual path. We have two options here. We can map it to a user's virtual path or to a group's virtual path.
In most of our tutorials, we've been mapping network storage objects to a user's virtual path. This time let's map this network storage to a group's virtual path for a change. If you're not familiar with groups, I suggest you read this page in the online documentation.
Note: In a production environment, you will probably want to segregate files belonging to different user accounts. In that case, it might be more appropriate to map each network storage object to a specific user account instead of a group.
For this example, we have two user accounts, 'tp1' and 'tp2'. Once we have our group ready, we'll be assigning these user accounts to that group.
To create a group, just go to the Groups module and click the Add button.
Give the group a name, say for example, 'sftp to azure group'.
Next, specify a virtual path for this group. For example, '/sftptoazure'. So, whenever a member user account of this group logs in to our server, that user will find a virtual path named 'sftptoazure' under its root virtual path.
To map this virtual path to our Azure Blob network storage object, we simply tick the Network Storage option button and select the network storage object in question from the drop-down list.
Once you're done here, click OK.
You should then see your newly created group in the Groups module. For our last step, we just need to add our two users to this group. To do that, just click the Users button.
Then select the users you wish to add. So, in our case, that would be tp1 and tp2. Click OK to proceed.
Note that all members of this group will initially have equal permissions to the virtual path. You might want to apply some restrictions in a production environment. For example, you might want to limit user permissions to just uploads or any other functionality. For more information about virtual path permissions read this page in the online documentation.
Now we're ready to try this. Let's launch our file transfer client and connect to our SFTP service using login credentials of one of our trading partner user accounts. Let's just use tp1 for this example.
Once tp1 logs in, the folder named 'sftptoazure', which is the virtual path mapped to our Azure Blob network storage, should be visible right away from tp1's root path.
If we navigate into that virtual path, we should see exactly the same files we saw earlier in our Azure Blob storage folder.
And if we upload a file to that folder:
Then check inside the Azure file storage, we should see the newly uploaded file there.
That's it. Now you know how to configure JSCAPE MFT Server so it can automatically transfer files from SFTP to Azure Blob Storage.
For my second use case, which I'm going to illustrate in a separate post, I'm going to assume what you actually want is to have your SFTP server store those files locally first and then forward those files to Azure Blob Storage at a later time. Stay tuned for that.
Get Your Free Trial
Would you like to try this yourself? JSCAPE MFT Server is platform-agnostic and can be installed on Microsoft Windows, Linux, Mac OS X and Solaris, and can handle any file transfer protocol as well as multiple protocols from a single server. Additionally, JSCAPE enables you to handle any file type, including batch files and XML. Download your free 7-day trial of JSCAPE MFT Server now.
Download JSCAPE MFT Server TrialRelated Content
How To Transfer Files Between Cloud Storage Services
How To Auto Upload Files To A Server From A Local Directory