Some additional information in one line

Writing to Azure blob storage from MOVEit Automation

Technical top tips for MOVEit MFT

Ipswitch have added several new features to MOVEit Automation in the last year, including a connector for Amazon S3 storage in MOVEIt 2018 to upload and download files. As yet though, there is no connector for Azure storage. We will wait to see if this is added to next year’s releases, but in the meantime you can create your own connectors using Powershell as a process.

Firstly, it is important to mention that a process and a destination do not work in the same way. While you can easily script an upload through a process, the results (files, byte counts) will not appear in reporting, as is shown in this image:


Admittedly, you can drill down to the detail, but even that does not necessarily show you everything that happened. In this example the file was uploaded with a new name and directory structure, but that isn’t recorded:

Azure 2


Getting started

Azure blob storage does not work like a traditional file system. Objects (‘blobs’) are written to a single area known as a container. You may have several containers defined under a storage account, and may have several storage accounts defined in your Azure profile. A container works a bit like a folder, but is in fact closer to a bucket. When you write a blob to a container, you may optionally embed one or more slashes into the name. This doesn’t create true folders, but from a practical standpoint it helps keep things in some kind of order. Always remember though that the slash is part of the name.

Before you start trying to script anything, be sure to install the Azure Powershell library:

Any script that you run will need to import the modules AzureRM.Profile and Azure.Storage. Or else these need to be in the MOVEit Automation user profile. You can do this with:

Import-Module -name “<powershell module library>\AzureRM.Profile”

Import-Module -name “<powershell module library>\Azure.Storage”

Connecting to Azure Storage

You need to authenticate to use Azure blob storage. It’s easiest to use a storage key, rather than enter credentials. Get this by going to your Azure portal and checking the access keys of your storage account (you can also get it via powershell if you prefer).

Once you have the key, you need to set the storage context. This is a straight forward command:

$StorageContext = New-AzureStorageContext -StorageAccountName <Storage Account name> -StorageAccountKey <Storage Key>

Finally, add a line to upload a file. This one uploads file “c:\temp\123.txt” into the container “uploads”

Set-AzureStorageBlobContent -Context $StorageContext -Container “uploads” -File “c:\temp\123.txt”

You can also set a new destination name if required using the ‘blob’ option. You can control overwriting of existing files using the ‘-Force’ parameter if required.

Pull it into MOVEit

So we now have a basic script which can be pulled into MOVEit Automation. Using the Automation web portal, we can import these few lines, then modify them using the powershell script editor.

There are some MOVEit-specific functions that you can obviously only test from inside the product that we will need to use:

  • MIGetTaskParam
    So that we can pass parameters
  • MIGetOriginalFilename
    Get the original filename
  • MICacheFilename
    The file that we will upload

You may also want to use MISetErrorCode and MISetErrorDescription to display any errors. If you do this it makes sense to wrap the whole thing up in one try – catch.

This is my script:

try {
Import-Module -name “c:\program files\windowspowershell\modules\AzureRM.Profile”
Import-Module -name “c:\program files\windowspowershell\modules\Azure.Storage”

$Storageaccountname = $miaclient.MIGetTaskParam(“StorageAccountName”)
$Storagekey = $miaclient.MIGetTaskParam(“StorageKey”)
$Container = $miaclient.MIGetTaskParam(“Container”)
$NewName = $miaclient.MIGetTaskParam(“NewName”)

if ($NewName -eq “”) {$NewName = $miaclient.MIGetOriginalFilename()}
$MIFile = $miaclient.MICacheFilename()

$StorageContext = New-AzureStorageContext -StorageAccountName $Storageaccountname –
StorageAccountKey $Storagekey
Set-AzureStorageBlobContent -Context $StorageContext -Container $Container -File $MIFile -Blob
$NewName -Force
} catch {

The script is then called from a task, passing parameters:

Azure 3

Azure 4

Finally, you can create a new container through script as part of the upload process:

New-AzureStorageContainer -Context $StorageContext -Name mynewcontainer

If you wish to download files, use the following syntax instead:


Get-AzureStorageBlobContent -Context $StorageContext -Container “uploads” -blob banana.xls

This will provide a basic solution, but if you would like to discuss more complex requirements, please contact us on 0333 123 1240 or email your account manager.

Need UK-based MOVEit support?

We are certified Progress MOVEit Titanium Partners and our team includes the UK’s leading MOVEit expert.
See our range of support and consultancy services to help you get the most out of your MOVEit solution.