This repository contains PowerShell scripts to use WinSCP to transfer files an FTP server and Azure blob storage.
To use these scripts, you will need to complete the following setup.
-
Install Az.Storage PowerShell module:
# Open PowerShell as an Administrator $TLS12Protocol = [System.Net.SecurityProtocolType] 'Ssl3 , Tls12' [System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol Install-Module az.storage
-
Setup FTP credential file:
# Open Powershell (Ensure you are logged in with the same account that will run the script as a scheduled task) # CD to location where script is saved $FtpCred = Get-Credential -Message "Enter FTP Username and Password" $FtpCred | Export-Clixml .\ftpcred.xml
-
Setup Azure storage account credential file
# Open Powershell (Ensure you are logged in with the same account that will run the script as a scheduled task) # CD to location where script is saved $AzCred = Get-Credential -Message "Enter Azure storage account access key in Password" -Username "None" $AzCred | Export-Clixml .\azblobkey.xml
-
OPTIONALLY: Setup credential file for SMTP authentication for email
# Open Powershell (Ensure you are logged in with the same account that will run the script as a scheduled task) # CD to location where script is saved $SmtpCred = Get-Credential -Message "Enter SMTP Auth Username and Password" $SmtpCred | Export-Clixml .\smtpcred.xml
.\File_Transfer.ps1 -JobName "TestFtpToAzure" `
-FtpServer "ftp1-ip.westus2.cloudapp.azure.com" `
-FtpFolder "/test2" `
-FtpCredentialPath .\ftpcred.xml `
-AzureStorageAccountName "jeffazureftp" `
-AzureContainerName "to-auto-hr" `
-AzureBlobKeyPath .\azblobkey.xml `
-Direction "FromFtpToAzureBlob" `
-CustomerEmail "[email protected]" `
-AdminEmail "[email protected]" `
-SendSuccessEmail:$true `
-SmtpServer "10.10.10.15" `
-KeepFiles:$false `
-FromEmail "[email protected]" `
-SmtpAuthCredentialPath .\smtpcred.xml
.\File_Transfer.ps1 -JobName "TestAzureToFtp" `
-FtpServer "ftp1-ip.westus2.cloudapp.azure.com" `
-FtpFolder "/test1" `
-FtpCredentialPath .\ftpcred.xml `
-AzureStorageAccountName "jeffazureftp" `
-AzureContainerName "from-auto-hr" `
-AzureBlobKeyPath .\azblobkey.xml `
-Direction "FromAzureBlobToFtp" `
-CustomerEmail "[email protected]" `
-AdminEmail "[email protected]" `
-SendSuccessEmail:$true `
-SmtpServer "10.10.10.15" `
-KeepFiles:$false `
-FromEmail "[email protected]" `
-SmtpAuthCredentialPath .\smtpcred.xml