Freigeben über


Migrate To SharePoint Online using SharePoint Online PowerShell - Updated!

Recently, I have had a few customers how to migrate file share content and/or SharePoint list/library data without the use of 3rd Party tools while retaining metadata.  There are a few blogs posts out there that are helpful but I thought I would add an updated post on the process.  Check out O365  SharePoint PowerShell!

Requirements:

Migrate File share data/SharePoint content to SharePoint Online while retaining metadata.

Prerequisites:

  • SharePoint content being migrated must be at least SharePoint 2010 version. (Source)
  • Office 365 Subscription (Destination)
  • Azure Subscription
  • Download & Install SharePoint Online Management Shell - https://www.microsoft.com/en-us/download/details.aspx?id=35588

Overview

  • Prep for migration - if migrating list/library content, you must setup list/library on destination site.
  • Package Content
  • Convert Packaged Content
  • Upload Package Content to Azure
  • Start Migration

Create Directories to Package Content

  • Create directories to handle packaging of content.  These will contain xml information about your content.
    • Temp Package > c:\migration\ContosoDocsPackageSource
    • Final Package > c:\migration\ContosoDocsPackageTarget

Create Destination List/Library

  • If migrating file share data, ensure you have a place to land content in SPO
  • If migrating SharePoint list/library content, ensure you have destination list/library with needed columns

Setup Migration

$cred = (Get-Credential admin@contoso.onmicrosoft.com) $sourceFiles = 'C:\temp\migration\ContosoDocsPackage_Source' IF MIGRATING FILESHARE DATA, POINT TO FILES $sourcePackage = 'C:\temp\migration\ContosoDocsPackage_Source' $targetPackage = 'C:\temp\migration\ContosoDocsPackage_Target' $targetWeb = 'https://Contoso.sharepoint.com/' $targetDocLib = 'ContosoDocuments' $adminSite = 'https://Contoso-admin.sharepoint.com' $migrationMap = 'C:\temp\migration\contosoDocsUserMapping.csv' Optionally, map users when migration $azureAccountName = 'YOUR ACCOUNT NAME' $azureAccountKey = 'YOUR ACCOUNT KEY' $azureQueueName = 'YOUR QUEUE NAME, CAN BE ANYTHING' Connect-SPOService -Url $adminSite -Credential $cred

Create Migration Package

If migrating from File Share:
New-SPOMigrationPackage -SourceFilesPath $SourceFiles -OutputPackagePath $sourcePackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib

 

If migrating from SharePoint List/Library content:

On your SharePoint server export your list or library
Export-SPWeb -Identity "https://sp2013/" -Path C:\temp\migration\contosoDocsExport -ItemUrl "/ContosoDocuments/" -NoFileCompression -IncludeUserSecurity -IncludeVersions All

Copy exported files from export above to machine where SPO Management Shell is install (where your creating migration packages) to the "Temp Package."

Convert Migration Package

If migrating from File Share:
New-SPOMigrationPackage -SourceFilesPath $SourceFiles -OutputPackagePath $sourcePackage -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib

If migrating from SharePoint List/Library content: $finalPackages = ConvertTo-SPOMigrationTargetedPackage -SourceFilesPath $sourceFiles -SourcePackagePath $sourcePackage -OutputPackagePath $targetPackage -Credentials $cred -TargetWebUrl $targetWeb -TargetDocumentLibraryPath $targetDocLib -NoAzureADLookup -Verbose -UserMappingFile $migrationMap -ParallelImport

Couple things to note: I'm using -NoAzureADLookup as I don't existing users in target domain and want to map them to new users. Map users by using -UserMappingFile and using -ParallelImport improves migration time when running multiple migrations.

Create CSV:
$csv = New-Item -Path C:\temp\migration -Name userMappingTest.csv -ItemType File -Value "OnPremSID,UPN,isGroup" -Force Add-Content -Path $csv -Value "`nDomain\User,admin@contoso.onmicrosoft.com,FALSE"

Upload to Azure

$al = Set-SPOMigrationPackageAzureSource -SourceFilesPath $sourceFiles -SourcePackagePath $targetPackage -AzureQueueName $azureQueueName -AccountName $azureAccountName -AccountKey $azureAccountKey $al|Format-List

Submit Migration Job

Submit-SPOMigrationJob -TargetWebUrl $targetWeb -MigrationPackageAzureLocations $al -Credentials $cred

Get Job Progress

Get-SPOMigrationJobProgress -TargetWebUrl $targetWeb -Credentials $cred

References:

Use Windows PowerShell cmdlets for SharePoint Online and OneDrive Migration
https://technet.microsoft.com/en-us/library/mt143608.aspx

SharePoint Online and OneDrive Migration User Guide
https://technet.microsoft.com/en-us/library/mt203923.aspx?f=255&MSPPError=-2147217396

SharePoint Online limits and quotas
https://support.office.com/en-us/article/SharePoint-Online-limits-and-quotas-8f34ff47-b749-408b-abc0-b605e1f6d498?ui=en-US&rs=en-US&ad=US

Microsoft Azure Storage Performance and Scalability Checklist
/en-us/azure/storage/storage-performance-checklist

Upload on-premises content to SharePoint Online
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