Finding Unlicensed OneDrive Accounts Across Microsoft 365 with Microsoft Graph

OneDrive for Business is often tied closely to a user’s license lifecycle.

When a user leaves the organization, changes roles, loses a license, or is deleted from Entra ID, their OneDrive does not simply disappear immediately. There is a lifecycle behind the scenes, and if admins are not tracking it, unlicensed OneDrive accounts can become a storage, compliance, governance, and recovery problem.

That is why I built a PowerShell toolkit to help identify and manage unlicensed OneDrive accounts across Microsoft 365 tenants using Microsoft Graph:

Unlicensed OneDrive Report

The main script is:

Get-UnlicensedOneDriveReport.ps1

Why this matters

Unlicensed OneDrive accounts usually show up during normal tenant operations:

  • A user leaves the company.
  • A license is removed.
  • A user is deleted from Entra ID.
  • A licensing plan changes.
  • A OneDrive site remains behind after the account lifecycle moves on.

Individually, these may not seem like a big issue. At tenant scale, they become much harder to manage.

Admins need to know:

  • Which users have unlicensed OneDrive accounts?
  • Which OneDrives are approaching read-only status?
  • Which OneDrives are approaching archive status?
  • Which OneDrives are already archived?
  • How much storage is involved?
  • What could reactivation or archive storage cost?
  • Which accounts need offboarding or manager handoff?

Without automation, answering those questions can require manual admin center checks, exports, or separate geo-specific steps.

The Microsoft OneDrive unlicensed account lifecycle

Microsoft documents an enforcement lifecycle for unlicensed OneDrive accounts.

At a high level:

MilestoneWhat happens
Day 60OneDrive enters read-only mode.
Day 93OneDrive is archived.
Day 275Archived site can become undiscoverable with eDiscovery if PAYG is not enabled. This enforcement began January 27, 2025.
Day 365OneDrive enters the deletion risk window. This enforcement began January 27, 2025.

The important point is this: admins should not wait until a user calls, a manager needs files, or an audit request appears.

The better approach is to report on these accounts before they become urgent.

What the script does

Get-UnlicensedOneDriveReport.ps1 is designed to identify unlicensed OneDrive accounts using Microsoft Graph.

The script looks for three important populations.

Population 1: Active users without an enabled OneDrive or SharePoint plan

These are users who still exist in Entra ID, but no longer have an active OneDrive or SharePoint Online service plan.

That can happen when:

  • A license was removed.
  • A license assignment changed.
  • A user was moved to a license without OneDrive.
  • A service plan was disabled inside a license.

The script checks assigned plans and determines whether the user still has an enabled OneDrive or SharePoint service plan.

Population 2: Soft-deleted users

These are users deleted from Entra ID but still present in the deleted users recycle bin.

This is an important window because the user object still exists, and the deleted date can be used to help determine where the OneDrive is in its lifecycle.

For admins, this is often the best time to take action:

  • Confirm ownership.
  • Hand off access to a manager.
  • Preserve required content.
  • Lock or review the OneDrive.
  • Decide whether the data is still needed.

Population 3: Already archived OneDrive sites

Some OneDrive sites belong to users who were deleted long enough ago that the Entra user object is no longer available.

In that case, simply looking at active users or deleted users is not enough.

The script can also discover already archived personal OneDrive sites by enumerating SharePoint sites. This helps identify accounts that would otherwise be missed by user-based reporting alone.

Why Microsoft Graph is useful here

One of the biggest benefits of this approach is that it uses Microsoft Graph instead of relying only on manual navigation or one-off admin center exports.

The script is designed to work across Microsoft 365 tenant data using Graph APIs for:

  • Users
  • Assigned plans
  • Deleted users
  • OneDrive drive metadata
  • Directory audit logs
  • SharePoint personal sites
  • Optional email notifications

For multi-geo tenants, the script is especially useful because Graph can route OneDrive requests to the correct geography using a single app registration in the home tenant.

That means no per-geo token juggling and less manual admin center work.

What the report gives you

The output is a timestamped CSV report.

The report is designed to help admins prioritize action, not just list accounts.

Typical report details include:

  • User source
  • Display name
  • User principal name
  • OneDrive URL
  • Unlicensed date when available
  • Days until read-only
  • Days until archive
  • Urgency status
  • Storage used
  • Archive/reactivation cost estimates
  • Drive metadata
  • Lifecycle milestone dates

That makes the report useful for both technical review and operational planning.

Example urgency model

A good report should help admins quickly decide what needs attention.

StatusMeaning
CriticalThe OneDrive is near or past an important lifecycle milestone.
WarningThe account is approaching read-only or archive status.
MonitorThe account is unlicensed but not yet urgent.
ArchivedThe OneDrive has already moved into an archived state.
OKNo immediate action required based on configured thresholds.

This is much easier to work with than a raw export that leaves every decision to the admin.

Optional email notifications

The script also includes optional email notification support.

This allows admins to send alerts before key lifecycle milestones, such as:

  • Approaching read-only
  • Approaching archive
  • Approaching re-archive
  • Approaching deletion risk window

This is useful when the report becomes part of a recurring operational process.

For example, you could run the report weekly and notify administrators when specific accounts are getting close to a lifecycle threshold.

Cost awareness

Another useful part of the script is cost estimation.

Archived OneDrive accounts can have storage and reactivation cost implications. The script includes configurable cost values so admins can estimate:

  • Monthly archive storage cost
  • One-time reactivation cost

This helps turn the report into something leadership and operations teams can understand.

Instead of saying, “We have archived OneDrive accounts,” you can say:

  • How many accounts are affected
  • How much storage is involved
  • Which accounts need action
  • What the potential cost exposure looks like

A practical workflow

Here is how I would recommend using the report.

Step 1: Run discovery

Start by running the report without taking action.

The first goal is visibility.

You want to know:

  • How many unlicensed OneDrive accounts exist?
  • Which ones are active users?
  • Which ones are soft-deleted users?
  • Which ones are already archived?
  • Which accounts are closest to lifecycle milestones?

Step 2: Prioritize by urgency

After the report is generated, sort by urgency and lifecycle dates.

Start with:

  1. Accounts close to read-only
  2. Accounts close to archive
  3. Already archived accounts
  4. Large OneDrive sites with high storage usage
  5. Executive, legal, HR, finance, or regulated accounts
  6. Users with unclear ownership

This lets admins focus on the accounts that matter most.

Step 3: Validate business ownership

Before deleting, archiving, or handing off data, validate ownership.

For departed users, that usually means identifying:

  • Manager
  • Department
  • Business owner
  • Legal or compliance requirements
  • Retention requirements
  • Project or customer impact

The report gives you the technical facts. The business still needs to decide what should happen to the data.

Step 4: Feed into offboarding

This repo also includes an offboarding script:

OneDriveOffboarding.ps1

That script can help automate manager handoff workflows by:

  • Resolving the user and manager
  • Granting manager access
  • Optionally locking the OneDrive
  • Inventorying active sharing links
  • Sending manager notification emails
  • Exporting a run summary

This creates a natural flow:

  1. Discover unlicensed OneDrives.
  2. Prioritize accounts.
  3. Confirm business ownership.
  4. Hand off access where needed.
  5. Track completion.

Step 5: Schedule recurring reviews

Unlicensed OneDrive accounts are not a one-time problem.

Licenses change constantly. Users leave. Accounts are deleted. OneDrives continue through their lifecycle.

That is why this should be a recurring process.

A good operating model might be:

FrequencyAction
WeeklyRun report and review critical/warning accounts.
MonthlyReview archived accounts and cost exposure.
QuarterlyValidate offboarding process and retention alignment.
As neededTrigger manager handoff for specific accounts.

Required permissions

The script uses Microsoft Graph application permissions.

Depending on which features you enable, permissions may include:

  • User.Read.All
  • Directory.Read.All
  • Files.Read.All
  • AuditLog.Read.All
  • Sites.Read.All
  • Mail.Send

Some SharePoint admin export or offboarding operations may require additional SharePoint permissions.

As always, use the least privilege model that supports your scenario, and review permissions before using any automation in production.

Security note

If you use the script, make sure you do not publish real tenant IDs, client IDs, certificate thumbprints, secrets, admin URLs, or internal email addresses in public documentation or screenshots.

Use placeholders in examples and keep production configuration values private.

Where this fits in Microsoft 365 governance

Unlicensed OneDrive reporting is not just a storage task.

It connects to several governance areas:

  • User offboarding
  • Data retention
  • Legal hold
  • Manager handoff
  • Storage cost management
  • External sharing cleanup
  • Copilot readiness
  • Lifecycle management

If a tenant has many unlicensed or abandoned OneDrive accounts, that may also indicate gaps in the offboarding process.

This report helps surface those gaps.

Final thoughts

Unlicensed OneDrive accounts are easy to overlook until they become urgent.

By using Microsoft Graph, admins can build a repeatable reporting process that identifies active, deleted, and archived OneDrive scenarios across the tenant. That gives teams time to review ownership, preserve required data, estimate cost, and complete offboarding before lifecycle milestones become a problem.

You can find the toolkit here:

Unlicensed OneDrive Report

And the main discovery script here:

Get-UnlicensedOneDriveReport.ps1

Leave a Reply