> For the complete documentation index, see [llms.txt](https://docs.realmjoin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmjoin.com/automation/runbooks/runbook-references/org/collab/check-onedrive-status.md).

# Check Onedrive Status

Check whether a user's OneDrive is active, locked or deleted

### Description

Looks up the personal OneDrive site of a user and reports whether it is active or archived, whether it is locked, and whether it sits in the tenant recycle bin. Works for users whose account has already been deleted, as their OneDrive may still be in the recycle bin. Nothing is changed.

### Common use cases

* Check whether an active user's OneDrive is provisioned and, if so, whether it is locked or archived.
* Check whether a deleted user's OneDrive still exists in the tenant recycle bin, and when it is scheduled to be purged.

### Parameter behaviour

* `UserPrincipalName` accepts the UPN of an already deleted account, not only of active users. This is intentional: a user picker cannot select a deleted account, so the parameter is free text rather than a picker.
* For a deleted user, the recycle bin lookup matches on the deleted site's `SiteOwnerEmail`. A missing value or a prior UPN rename can cause a false "Not found" result.

The runbook is strictly read-only and makes no changes to the tenant.

### Location

Organization → Collab → Check Onedrive Status

**Full Runbook name**

rjgit-org\_collab\_check-onedrive-status

### Details

| Property         | Value                                                                   |
| ---------------- | ----------------------------------------------------------------------- |
| Version          | 1.5.0                                                                   |
| Required modules | <p>RealmJoin.RunbookHelper (>= 0.8.10)<br>PnP.PowerShell (>= 3.4.1)</p> |
| Schedulable      | no                                                                      |

### Permissions

#### Application permissions

* **Type**: Office 365 SharePoint Online
  * Sites.FullControl.All
    * *Required by Connect-PnPOnline against the SharePoint admin center and by the tenant-admin cmdlets Get-PnPTenantSite and Get-PnPTenantDeletedSite, which enumerate/inspect any site collection (including OneDrive personal sites and the tenant recycle bin) and are not exposed under the lower Sites.Read.All / Sites.ReadWrite.All application scopes. Get-PnPUserProfileProperty and Get-PnPWeb are also covered by this grant.*

#### Permission notes

SharePoint Online: grant 'Sites.FullControl.All' application permission on the Office 365 SharePoint Online API (AppId 00000003-0000-0ff1-ce00-000000000000) to the Automation account's system-assigned managed identity. This SharePoint app-only grant cannot be made through the standard Entra app-role-assignment automation used for Microsoft Graph and must be assigned manually per tenant (e.g. via the SharePoint admin center or the Grant-PnPAzureADAppSitePermission equivalent for managed identities).

### Parameters

#### UserPrincipalName

User principal name of the user whose OneDrive is checked. Deleted users are accepted.

| Property            | Value               |
| ------------------- | ------------------- |
| Required            | true                |
| Default Value       |                     |
| Type                | String              |
| Portal display name | User principal name |

[Back to Runbook Reference overview](/automation/runbooks/runbook-references.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.realmjoin.com/automation/runbooks/runbook-references/org/collab/check-onedrive-status.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
