Netpump file transfers can be initiated programmatically over an HTTPS REST API. We supply a PowerShell module that provides a convenient interface to make these API calls using the Start-NetpumpTransfer
command.
The Netpump PowerShell script depends on Microsoft’s Az PowerShell module.
Your PowerShell environment must call Connect-AzAccount to authenticate prior to calling Start-NetpumpTransfer
.
The Azure account you use must have the Automation role for the Netpump Server App Registration in Azure.
The module is contained in Netpump.zip. Extract this zip file and use the PowerShell command Import-Module .\Netpump.psm1
to import it.
The Start-NetpumpTransfer
command starts a transfer.
Run Get-Help Start-NetpumpTransfer
to see further documentation.
In this example we will create an Azure Automation Runbook to initiate a Netpump file transfer.
We will create the Automation Account, grant the Automation Account’s Service Principal permission to use the Netpump cluster, create a simple Runbook, and transfer a file.
You will need two Netpump servers in a Netpump cluster already set up.
For the initial setup, you will need PowerShell with the Microsoft.Graph module installed. (Run Install-Module Microsoft.Graph -Scope CurrentUser
, or see Microsoft.Graph documentation for further installation options.)
You will need to know the following information, which you would have used when setting up your Netpump servers:
Automation
role you created during the App RegistrationIn Azure Portal, create a new Automation Account
Click in the Identity section in the left menu and copy the Object (principal) ID to the clipboard
Connect-MgGraph -TenantId $tenantId -Scopes "User.Read","Application.ReadWrite.All"
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $SERVICE_PRINCIPAL_OBJECT_ID -PrincipalId $SERVICE_PRINCIPAL_OBJECT_ID -ResourceId $NETPUMP_ENTERPRISE_APP_OBJECT_ID -AppRoleId $AUTOMATION_APP_ROLE_ID
. Replace each of the $VARIABLEs in this command with your actual values, which will all be GUIDs in the format 00000000-0000-0000-0000-000000000000
.To confirm that the above command was successful, check the Enterprise Application for your Netpump cluster, on the Users and groups page, the name of your Automation Account should now appear in the list.
Back in the Automation Account, click in the Modules section in the left menu and click Add a Module
Upload the Netpump.zip
file and choose 5.1 for the PowerShell version. Click Import.
Go to the Runbooks section in the left menu and click Create a runbook.
Choose a name for the runbook, type of PowerShell, version 5.1, and click Create.
Connect-AzAccount -Identity
Import-Module Netpump
Start-NetpumpTransfer -DestinationService https://YOUR-URL -DestinationFolder \\YOUR-UNC\YOUR-SHARE\YOUR-FOLDER -OriginService https://YOUR-URL -Paths \\YOUR-UNC\YOUR-SHARE\YOUR-SOURCE-FILE
Click Publish
Click Start, and Yes to confirm