Import PST Files to a Shared Mailbox in Microsoft 365

Diagram overlay showing PST file import into a Microsoft 365 shared mailbox
Spread the love

Home
/
Exchange
/
Import PST Files to a Shared Mailbox in Microsoft 365

Last Updated: July 2026

To import PST files to a shared mailbox in Microsoft 365, upload them to Azure storage with AzCopy, then run a Microsoft Purview Network Upload import job with a mapping CSV. This routes every PST into the target mailbox. As a result, you can also assign each PST its own folder, and confirm nobody touched the mailbox first with a PowerShell audit report.

Why Import PSTs Into a Shared Mailbox

A shared mailbox centralizes old PST archives from multiple former mailboxes into one searchable, permission-controlled location. In my testing, this comes up most often during offboarding, legal holds, or consolidating years of scattered .pst exports from departed staff or closed client engagements.

Because a shared mailbox doesn’t need its own license for storage under 50GB, it’s a cost-effective landing zone. However, once sensitive mail lands there, you also inherit a responsibility: proving who can see it, and who actually has. If you’re also dealing with bounced messages during this process, our guide on Exchange NDR messages and how to fix them is a useful companion resource.

Prerequisites Before You Start

Before touching the Purview portal, get three things in place. Otherwise, you’ll hit the exact errors covered later in this guide.

1. Connect to Exchange Online PowerShell

Every PowerShell step in this guide, including the role assignment and both audit reports, runs inside an Exchange Online PowerShell session. Therefore, connect first before anything else.

# Install the module (one-time, if not already installed)
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser

# Import it and connect
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName admin@contoso.onmicrosoft.com

A sign-in prompt appears. After that, your prompt should read [ConnectionUri...] or similar, confirming you’re connected. If this step throws a token or logon-session error, jump to the error table below — it’s a common one.

2. Assign the Mailbox Import Export Role

This role is not assigned by default in Exchange Online, and Microsoft explicitly warns it can take up to 24 hours to replicate. So, assign it as early as possible in your project timeline.

New-ManagementRoleAssignment -Role "Mailbox Import Export" -User admin@contoso.onmicrosoft.com

# Verify the assignment landed
Get-ManagementRoleAssignment -Role "Mailbox Import Export" | Format-Table Name, Role, RoleAssigneeName -AutoSize

3. Install AzCopy Correctly

AzCopy is a standalone executable, not a PowerShell module. Consequently, if you just download the zip and run azcopy from any folder, PowerShell won’t recognize it unless that folder is in your session’s working directory or system PATH.

4. Confirm Mailbox Audit Logging Is On

Get-OrganizationConfig | Format-List AuditDisabled
Get-Mailbox sharedarchive@contoso.onmicrosoft.com | Format-List AuditEnabled

# If AuditEnabled is False, turn it on
Set-Mailbox sharedarchive@contoso.onmicrosoft.com -AuditEnabled $true

Run a Baseline Access Audit First

Because this data is sensitive, run your access report before the import — not after. This gives you a clean “zero access” starting point to compare against later. This same before/after pattern is one we use in our Active Directory lockout caller PowerShell report, if you want another example of PowerShell-driven audit reporting.

# Create the reports folder first — see the error table below for why this matters
New-Item -Path "C:\Reports" -ItemType Directory -Force

Get-MailboxPermission -Identity sharedarchive@contoso.onmicrosoft.com |
    Where-Object { $_.User -notlike "NT AUTHORITY\SELF" } |
    Select-Object Identity, User, AccessRights, IsInherited |
    Export-Csv "C:\Reports\Baseline-Permissions.csv" -NoTypeInformation

Get-RecipientPermission -Identity sharedarchive@contoso.onmicrosoft.com |
    Select-Object Identity, Trustee, AccessRights |
    Export-Csv "C:\Reports\Baseline-SendAs.csv" -NoTypeInformation

Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-7) -EndDate (Get-Date) `
    -FreeText "sharedarchive@contoso.onmicrosoft.com" `
    -Operations MailItemsAccessed,FolderBind,SoftDelete,HardDelete,MoveToDeletedItems,SendAs,SendOnBehalf `
    -ResultSize 5000 |
    Export-Csv "C:\Reports\Baseline-AccessLog.csv" -NoTypeInformation

# Confirm it's clean
Import-Csv "C:\Reports\Baseline-AccessLog.csv" | Measure-Object

If Measure-Object returns a Count of 0, you have your clean baseline. Keep this CSV — you’ll compare it against the post-import report shortly.

Step 1: Create the Purview Import Job

Microsoft moved this feature under the new Purview portal. Go to purview.microsoft.com → Home → View all solutions → Data lifecycle management → Import. Older bookmarks pointing to compliance.microsoft.com will redirect here. For Microsoft’s own reference, see Use network upload to import PST files to Microsoft 365.

  1. Click + New import job and give it a lowercase, no-space name.
  2. Choose Upload your data → Next.
  3. Click Show network upload SAS URL and copy it somewhere safe.

Step 2: Upload PSTs With AzCopy

Put all your PST files in one local folder, then run AzCopy from that same folder (or the folder where azcopy.exe lives) to avoid the “not recognized” error covered below. Download the latest version from Microsoft’s AzCopy v10 documentation if you don’t already have it.

azcopy copy "C:\PSTUpload\*.pst" "<your SAS URL>" --recursive=true

A successful run ends with a summary showing Final Job Status: Completed and a transfer count matching your total PST file count.

Common AzCopy Errors and Fixes

“azcopy is not recognized as the name of a cmdlet…” — This means Windows can’t find azcopy.exe in your current path. Fix it one of two ways:

# Option 1: cd into the exact folder where azcopy.exe was extracted, then run it
cd "C:\Tools\azcopy_windows_amd64"
.\azcopy.exe copy "C:\PSTUpload\*.pst" "<your SAS URL>" --recursive=true

# Option 2: add the AzCopy folder to your PATH for the current session
$env:Path += ";C:\Tools\azcopy_windows_amd64"
azcopy copy "C:\PSTUpload\*.pst" "<your SAS URL>" --recursive=true

Step 3: Build the Mapping CSV (Per-Client Folders)

If you’re consolidating PSTs from several source mailboxes, keep them visually separated. Set a unique TargetRootFolder value per row, and Exchange creates that folder automatically at the mailbox root.

WorkloadFilePathNameMailboxIsArchiveTargetRootFolder
ExchangeClientA-Emails.pstsharedarchive@contoso.onmicrosoft.comFALSEClient A Import
ExchangeClientB-Emails.pstsharedarchive@contoso.onmicrosoft.comFALSEClient B Import

Leave FilePath blank if your PSTs sit at the container root (the default with a plain AzCopy command). Only fill it in if you appended a subfolder to your SAS URL during upload.

Common Mapping CSV Errors

Validation failures almost always trace back to one of these: a filename that doesn’t exactly match the uploaded blob (case and spacing matter), a CSV saved in the wrong encoding, or invisible trailing spaces from copy-pasting filenames. Save your file as CSV UTF-8 (Comma delimited) in Excel to avoid encoding issues.

Step 4: Run and Monitor the Import

  1. Back in the job, choose I’m done uploading my files, and I have access to the mapping file → upload the CSV → Validate.
  2. Once validation passes with 0 errors, click SaveClose.
  3. Select the job → Import to Office 365. Skip filters if you want the full PST content.
  4. Watch the status until it reads Completed, then verify folder structure in Outlook or OWA.

Step 5: Run the Post-Import Audit Report

Once the import finishes, re-run the same audit query used for your baseline. This time, the log should show only the Purview import activity — not any unauthorized human access.

Search-UnifiedAuditLog -StartDate (Get-Date).AddDays(-1) -EndDate (Get-Date) `
    -FreeText "sharedarchive@contoso.onmicrosoft.com" `
    -Operations MailItemsAccessed,FolderBind,SoftDelete,HardDelete,MoveToDeletedItems,SendAs,SendOnBehalf `
    -ResultSize 5000 |
    Export-Csv "C:\Reports\PostImport-AccessLog.csv" -NoTypeInformation

Compare row counts and event types between Baseline-AccessLog.csv and PostImport-AccessLog.csv. Since the Mailbox Import Export operation runs as a service process rather than an interactive user, it typically won’t appear as a standard mailbox logon event — which is exactly the evidence you want for a “controlled process, no manual access” report.

Cleanup: Removing Staging Data Securely

Two separate copies of this sensitive data now exist outside the shared mailbox, and both need deliberate cleanup. For more detail on staging retention behavior, Microsoft’s Importing PST files FAQ is worth a read. If your mail environment also needs broader hardening after a migration like this, our One-Click Exchange Mitigation Tool and our writeup on the recent Exchange Server vulnerability (CVE-2026-42897) are worth reviewing.

The Azure Staging Container

This is a temporary container Microsoft manages for the import job, accessible only via your SAS token. Delete the import job itself in Purview once you’ve verified the mailbox contents — this signals cleanup of the associated staging data.

Local PST Copies

# Basic delete (leaves data recoverable on disk)
Remove-Item "C:\PSTUpload\*.pst" -Force

# Secure delete with SDelete (Microsoft Sysinternals) — overwrites before deleting
sdelete64.exe -p 3 "C:\PSTUpload\*.pst"

Architecture Diagram: The Full Import Flow

The diagram below shows the complete path a PST file takes, from the source mailbox export to its final folder inside the shared mailbox.

SourcePST FilesAzCopyUploadAzure BlobPurview StagingPurviewImport JobShared Mailbox — Per-Client Folders

Diagram: Core365 Cloud — end-to-end PST import flow into a Microsoft 365 shared mailbox.

Quick-Reference Error Table

ErrorCauseFix
Connect-ExchangeOnline: “specified logon session does not exist” (0x80070520)WAM token broker conflict, often from module 3.7.0+ or an elevated sessionDowngrade to 3.6.0, use a non-elevated window, or connect with -Device
Export-Csv: “Could not find a part of the path”Target folder doesn’t exist yetNew-Item -Path "C:\Reports" -ItemType Directory -Force
“azcopy is not recognized…”azcopy.exe isn’t in the current session’s PATHcd into the AzCopy folder, or add it to $env:Path
Import job creation fails / Import option missingMailbox Import Export role hasn’t finished replicatingWait up to 24 hours after New-ManagementRoleAssignment
CSV validation fails on a specific PST rowFilename mismatch, wrong encoding, or trailing spacesMatch filename exactly; save as CSV UTF-8; retype the cell manually

Frequently Asked Questions

What is a Microsoft Purview Network Upload import job?

It’s a Microsoft-supported method for bulk-importing PST files into Exchange Online mailboxes. You upload files to a temporary Azure staging container via AzCopy, then map them to destination mailboxes with a CSV.

Can I import multiple PST files into one shared mailbox?

Yes. List every PST as a separate row in the mapping CSV, and set the same Mailbox value across all rows to route them into a single destination.

How do I put each PST into its own folder in the shared mailbox?

Set a unique TargetRootFolder value per row in the mapping CSV. Exchange creates that folder at the mailbox root automatically.

Why does Connect-ExchangeOnline fail with “specified logon session does not exist”?

This is a known WAM broker conflict in certain ExchangeOnlineManagement module versions. Downgrading to 3.6.0 or connecting with the -Device flag resolves it.

Why do I need the Mailbox Import Export role, and how long does it take to activate?

It’s required to create Purview import jobs. Microsoft states it can take up to 24 hours to replicate after assignment, so assign it early in your project.

Why does AzCopy say “not recognized as the name of a cmdlet”?

AzCopy is a standalone executable, not a PowerShell module. Run it from its actual folder, or add that folder to your session’s PATH.

Why does Export-Csv fail with “Could not find a part of the path”?

The destination folder in your file path doesn’t exist yet. Create it first with New-Item -ItemType Directory.

What’s the difference between Search-MailboxAuditLog and Search-UnifiedAuditLog?

Search-MailboxAuditLog is deprecated. Search-UnifiedAuditLog is the current cmdlet, and it covers mailbox events alongside other Microsoft 365 audit activity.

How long does Microsoft keep my PST files in the Purview staging area?

Microsoft doesn’t publish a fixed guaranteed retention window for customer planning purposes. Treat it as sensitive data and delete the import job as soon as you’ve verified the mailbox contents.

Should I delete the local PST files after import?

Yes, once you’ve verified the import succeeded. Use a secure-delete tool like SDelete rather than a basic file deletion, since sensitive mail data shouldn’t remain recoverable on disk.

How can I prove no one accessed a sensitive shared mailbox?

Run a Search-UnifiedAuditLog query before and after any activity, and pair it with a Get-MailboxPermission snapshot showing exactly who holds delegate access.

What permissions do I need to run Get-MailboxPermission?

You need a role that includes mailbox-permission read access, such as the built-in Recipient Management role in Exchange Online.

Can I filter which PST folders get imported?

Yes. The Purview import job includes a filtering step for age, item type, and owner before you commit to the actual import.



Home » Microsoft » Exchange Server » Import PST Files to a Shared Mailbox in Microsoft 365

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
×