Transfer Or Migrate Data To SharePoint Online From Your Local File Share Or On-Premises SharePoint Using SharePoint Online Management Shell or The AzCopy Command-Line Utility

For a long time users have asked how to Transfer Or Migrate Data onto SharePoint Online From Your Local File Share, Or On-Premises SharePoint, Using PowerShell or the AzCopy Command-Line Utility.

There used to be a void of information but actually since 2015 there has been a way to do the job, in this post I will list two:

1 . By using plain PowerShell (for small data sets up to 4 Gb, there is no need for purchasing an Azure subscription when using this method) :

Install the latest version from SharePoint Online Management Shell
From <https://www.microsoft.com/fr-fr/download/details.aspx?id=35588>

Connect to SharePoint Online PowerShell
From <https://technet.microsoft.com/en-us/library/fp161372.aspx>

Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential

Refer to this article:
Upload on-premises content to SharePoint Online From <https://support.office.com/en-us/article/Upload-on-premises-content-to-SharePoint-Online-555049c6-15ef-45a6-9a1f-a1ef673b867c?ui=en-US&rs=en-US&ad=US>

And here is a Sample Script, to Migrate-FilesLessThan4GB, use it at your own risk:

$moduleResult = Get-Module Microsoft.Online.SharePoint.Powershell

if ($moduleResult -eq "")
{
Import-Module Microsoft.Online.SharePoint.Powershell
break;
}

$creds = Get-Credential
$sourceFiles = Read-Host "Enter the path to the files you want to migrate"
$sourcePackage = Read-Host "Enter the path to a dedicated folder the script can use to hold temporary data"
$targetPackage = Read-Host "Enter the path to a different dedicated folder the script can use to hold temporary data"
$targetWeb = Read-Host "Enter the URL to the target web"
$targetDocLib = Read-Host "Enter the Document Library Name"

New-SPOMigrationPackage -SourceFilesPath $sourceFiles -OutputPackagePath $sourcePackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib

ConvertTo-SPOMigrationTargetedPackage -SourceFilesPath $sourceFiles -SourcePackagePath $sourcePackage -OutputPackagePath $targetPackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib -Credentials $creds

$jobinfo = Invoke-SPOMigrationEncryptUploadSubmit -SourceFilesPath $sourceFiles -SourcePackagePath $targetPackage -Credentials $creds -TargetWebUrl $targetWeb

Get-SPOMigrationJobProgress -TargetWebUrl $targetWeb -AzureQueueUri $jobinfo.ReportingQueueUri -Credentials $creds -JobIds 825afe38-9afd-4c77-8567-cf50805a7a8c -EncryptionParameters $jobinfo.Encryption

 

2. By using the AzCopy Command-Line Utility to transfer data ( This more complex method might be more reliable when transfering large ammounts of data*, it requires  Azure subscription / Azure Storage Account):

Download and install the latest version of AzCopy.

*Size Limitations Note:
Note
 that the minimum possible value for option /SplitSize is 32MB. If the specified destination is Blob storage, AzCopy will split the data file once its sizes reaches the blob size limitation (200GB), regardless of whether option /SplitSize has been specified by the user.

Refer to article Transfer data with the AzCopy Command-Line Utility
From: https://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/

Note
This guide assumes that you are already familiar with Azure Storage. If not, reading the Introduction to Azure Storage documentation will be helpful. Most importantly, you will need to create a Storage account in order to start using AzCopy.

Overview
AzCopy is a Windows command-line utility designed for copying data to and from Microsoft Azure Blob, File, and Table storage using simple commands with optimal performance. You can copy data from one object to another within your storage account, or between storage accounts.

Lastly, there is an excellent blog from Nishant Shah describing how to do it, just be sure to use the new cmdlet “Invoke-SPOMigrationEncryptUploadSubmit” instead of the the old cmdlet "Submit-SPOMigrationJob" and, upgrade the Sharepoint Online Management Shell to the latest version if needed:

Migrate to SharePoint Online (O365–SPO) from On-Premise SharePoint or fileshare using new PowerShell migration APIs
https://blogs.technet.microsoft.com/nishants/2015/07/18/using-windows-powershell-cmdlets-for-sharepoint-online-o365spo-migration/

I hope you found this useful.

I whish you a nice and productive day !

Best regards,

Hélio de Andrade