> For the complete documentation index, see [llms.txt](https://docs.duplicati.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.duplicati.com/automation-and-integration/office-365-backup-and-restore.md). Agents can also search and read this documentation through its [MCP server](https://docs.duplicati.com/~gitbook/mcp).

# Microsoft 365 backup and restore

This page describes how Microsoft 365 backup and restore works with Duplicati

Duplicati supports backing up and restoring Microsoft 365 (Office 365) data through the Microsoft Graph API. The backup workflow captures content in native formats (for example, MIME for email and JSON for structured objects), and restore operations re-create items through the appropriate Graph API endpoints.

{% hint style="info" %}
Microsoft 365 backup and restore was added in Stable 2.3
{% endhint %}

{% hint style="warning" %}
The Microsoft 365 backup feature has a limit that covers up to **5 mailboxes or sites**. The license counter excludes unlicensed shared mailboxes. The Office 365 backup feature is source-available, but **not open-source** like the rest of Duplicati. There are no limitations on restore.

A license is required to use Microsoft 365 backup in production. Contact Duplicati Inc. support or sales to obtain a license.
{% endhint %}

### Overview

**Key characteristics**

* **Format preservation**: Data is stored in native formats such as MIME, JSON, and HTML.
* **Metadata retention**: Original timestamps, identifiers, and properties are preserved where possible.
* **Restore to local disk**: It is possible to restore all data to a local destination for forensics or manual investigation.
* **Cross-tenant support**: Data can be restored into different tenants.
* **Cross-target support**: Data from one user/group/site can be restored into another.
* **Shared mailboxes**: Shared mailboxes within the tenant are detected and enumerated automatically. Unlicensed shared mailboxes do not count toward the license limit.
* **SharePoint subsites**: Subsites beneath a site collection are included in the backup.
* **Classification filtering**: Users, sites and groups can be filtered at the top level based on their classification using `--office365-included-user-classifications`, `--office365-included-site-classifications`, and `--office365-included-group-classifications`.
* **Microsoft Entra ID directory**: The configuration of the tenant's directory, such as users, groups, roles, app registrations and Conditional Access policies, can be included in the backup and restored. This is not included by default, see [Microsoft Entra ID directory](#microsoft-entra-id-directory).

### Configure Microsoft 365 backup

To add a Microsoft 365 tenant to the backup, [set up a backup following the regular steps](https://docs.duplicati.com/getting-started/set-up-a-backup-in-the-ui.md). Then on the source page, click "Add remote path" in the top right:

<figure><picture><source srcset="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2FknJRzlKKXS0XZbAe47qY%2FScreenshot%202026-05-25%20at%2011.00.52.png?alt=media&amp;token=361d2d13-8888-471a-8ed7-f13407260e46" media="(prefers-color-scheme: dark)"><img src="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2FwWteHjjhkqbRsz7RDdKW%2FScreenshot%202026-05-25%20at%2011.00.14.png?alt=media&amp;token=a508210f-f7a8-41b5-a369-2448ee44b834" alt=""></picture><figcaption></figcaption></figure>

Type "365" in the search bar, or scroll down and find "Microsoft 365" in the list and click "Choose":

<figure><picture><source srcset="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2F17iirY5IChaCn0ktnypG%2FScreenshot%202026-05-25%20at%2011.01.06.png?alt=media&amp;token=6a96db26-9882-4a4f-a172-4c275a4dbd12" media="(prefers-color-scheme: dark)"><img src="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2Fol8rivmkpDG9Fgm3jmq8%2FScreenshot%202026-05-25%20at%2011.00.29.png?alt=media&amp;token=d39774f5-d81b-4f67-a7d1-3a8613af91a9" alt="" width="375"></picture><figcaption></figcaption></figure>

Fill in the information to set up the configuration. You need a Tenant Id, Client Id and Client Secret for the regular setup. See [Microsoft 365 credentials setup](https://docs.duplicati.com/automation-and-integration/microsoft-365-credentials-setup.md) for how to create them:

<figure><picture><source srcset="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2FaxbQnIjkNHxNwr10KZM1%2FScreenshot%202026-05-25%20at%2011.01.13.png?alt=media&amp;token=747c5bab-3867-49fe-bf50-cca4d92bea00" media="(prefers-color-scheme: dark)"><img src="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2F8owC6GUunEvUuC8DmFtP%2FScreenshot%202026-05-25%20at%2011.00.40.png?alt=media&amp;token=78a1f721-8c9d-4474-9140-4cab3411b847" alt="" width="563"></picture><figcaption></figcaption></figure>

Remember to test the configuration before clicking "Use remote source". You can also add the advanced options if you want to limit the content that is backed up. By default, everything is backed up:

<figure><picture><source srcset="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2F8KKT3DIATiSZKG934Wq8%2FScreenshot%202026-05-25%20at%2011.06.29.png?alt=media&amp;token=8b3e3448-7d06-4ffc-a9fe-2d477d9ade68" media="(prefers-color-scheme: dark)"><img src="https://2363712449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7cMJiGuXy340g9NzpxLY%2Fuploads%2F2oxqSNdRABKbXaNZ51mO%2FScreenshot%202026-05-25%20at%2011.06.08.png?alt=media&amp;token=71bec581-9a8b-4ee0-9b8f-2186c57c7ebe" alt="" width="563"></picture><figcaption></figcaption></figure>

### Microsoft 365 configuration options

To use the Microsoft 365 backup source you must supply a tenant ID and either a client secret or a certificate. When choosing what to back up, it is possible to filter on types (users, groups, etc), and possible to apply filters to obtain fine-grained exclusion of data.

When making backups of a Microsoft 365 tenant, the advanced option `--store-metadata-content-in-database` must be activated.

#### Authentication methods

| Method                                   | Description                                         | Use case                                               |
| ---------------------------------------- | --------------------------------------------------- | ------------------------------------------------------ |
| Client secret                            | App client credentials with secret                  | Automated or unattended backup                         |
| Certificate                              | OAuth 2.0 client credentials with X.509 certificate | Higher security environments                           |
| Delegated user (not currently supported) | OAuth 2.0 credentials for an AD super admin         | Not available, all access uses application permissions |

#### Connection configuration settings

<table><thead><tr><th width="299.38671875">Parameter</th><th width="321.6640625">Description</th><th>Required for</th></tr></thead><tbody><tr><td><code>--office365-tenant-id</code></td><td>Azure AD tenant ID (GUID or domain)</td><td>All</td></tr><tr><td><code>--office365-client-id</code></td><td>Azure AD application (client) ID</td><td>Client secret</td></tr><tr><td><code>--office365-client-secret</code></td><td>Client secret for authentication</td><td>Client secret</td></tr><tr><td><code>--office365-certificate-path</code></td><td>Path to X.509 certificate (alternative to secret)</td><td>Certificate</td></tr><tr><td><code>--office365-certificate-password</code></td><td>Certificate password if encrypted</td><td>Certificate</td></tr><tr><td><code>--office365-graph-base-url</code></td><td>Graph API base URL (default: <code>https://graph.microsoft.com</code>)</td><td>Sovereign clouds</td></tr><tr><td><code>--office365-scope</code></td><td>Set the permission scope (default: <code>https://graph.microsoft.com/.default</code></td><td>Custom permissions</td></tr></tbody></table>

#### Additional settings

| Parameter                                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--office365-included-root-types`                     | <p>The different root types to include for backups. The default settings include: <code>Users</code>, <code>Groups</code> and <code>Sites</code>.<br><br>Not included by default, but can be added from Canary 2.4.1.105: <code>Directory</code>, which holds the <a href="#microsoft-entra-id-directory">Microsoft Entra ID directory</a></p>                                                                                                              |
| `--office365-included-directory-types`                | <p>The parts of the Microsoft Entra ID directory to include in backups when the <code>Directory</code> root type is included. The default setting is to include all parts: <code>Organization</code>, <code>Users</code>, <code>Groups</code>, <code>AdministrativeUnits</code>, <code>Roles</code>, <code>Applications</code>, <code>ConditionalAccess</code>, <code>Policies</code> and <code>Devices</code>.<br><br>Available from Canary 2.4.1.105.</p> |
| `--office365-included-user-types`                     | <p>The data types to include from users in backups. The default settings include: <code>Profile</code>, <code>Mailbox</code>, <code>Calendar</code>, <code>Contacts</code>, <code>Planner</code> and <code>Chats</code>.<br><br>Not included by default, but can be added: <code>Tasks</code> and <code>Notes</code></p>                                                                                                                                    |
| `--office365-included-group-types`                    | <p>The data types to include from groups in backups. The default settings include: <code>Mailbox</code>, <code>Files</code>, <code>Planner</code> and <code>Teams</code>.<br><br>Not included by default, but can be added: <code>Calendar</code> and <code>Notes</code></p>                                                                                                                                                                                |
| `--office365-included-user-classifications`           | Top-level filter for users based on classification. A comma-separated list (flags) of: `Licensed`, `Unlicensed`, `SharedMailboxWithStorage`, `SharedMailboxWithoutStorage`. When set, only users matching the classification are included.                                                                                                                                                                                                                  |
| `--office365-included-group-classifications`          | Top-level filter for groups based on classification. A comma-separated list (flags) of: `Unified` (Microsoft 365 group), `NotUnified` (security group or distribution list). When set, only groups matching the classification are included.                                                                                                                                                                                                                |
| `--office365-included-site-classifications`           | Top-level filter for sites based on classification. A comma-separated list (flags) of: `Group` (group-connected team site), `Classic` (non-group team site), `Communication` (modern communication site), `Personal` (OneDrive for Business site), `Other`. When set, only sites matching the classification are included.                                                                                                                                  |
| `--office365-ignore-existing`                         | When restoring data into a tenant the default is to check for existing data to avoid creating duplicates. Use this option to always recreate data in the destination.                                                                                                                                                                                                                                                                                       |
| `--office365-directory-keep-conditional-access-state` | When restoring the Microsoft Entra ID directory, a Conditional Access policy that has to be created or brought back from the deleted items is left in report-only mode, and a policy that still exists keeps its current state. Use this option to restore the policies with the state they had in the backup. Available from Canary 2.4.1.105.                                                                                                             |
| `--office365-directory-restore-role-assignments`      | When restoring the Microsoft Entra ID directory, role assignments are not created. Use this option to restore role assignments, eligible role assignments and the scoped role members of administrative units. Available from Canary 2.4.1.105.                                                                                                                                                                                                             |

#### Permission types

* **Application permissions**: All backup and restore operations use Microsoft Graph application permissions, obtained through the OAuth 2.0 client credentials flow. Application permissions require admin consent.
* **Delegated permissions**: Not used. Duplicati does not sign in as a user, so no delegated permissions need to be granted.

The full list of required permissions is in the [API permissions reference](#api-permissions-reference).

### Supported data types

| Data type                     | Backup | Restore (\*) | Notes                                                                                                                                 |
| ----------------------------- | ------ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| User email                    | ✅      | ✅            | MIME format with metadata                                                                                                             |
| Email folders                 | ✅      | ✅            | Hierarchy preserved                                                                                                                   |
| Mailbox rules                 | ✅      | ✅            | Inbox rules and filters                                                                                                               |
| Mailbox settings              | ✅      | ✅            | Auto-replies, signatures                                                                                                              |
| OneDrive files                | ✅      | ✅            | Large file upload sessions supported                                                                                                  |
| OneDrive folders              | ✅      | ✅            | Structure preserved                                                                                                                   |
| File permissions              | ✅      | ✅            | Sharing restored via invite endpoint                                                                                                  |
| Calendar events               | ✅      | ✅            | Including recurrence patterns                                                                                                         |
| Calendar attachments          | ✅      | ✅            | File attachments on events                                                                                                            |
| Contacts                      | ✅      | ✅            | Including contact photos                                                                                                              |
| Contact folders               | ✅      | ✅            | Folder hierarchy preserved                                                                                                            |
| Planner plans                 | ✅      | ⚠️           | Plans cannot be created via API                                                                                                       |
| Planner buckets               | ✅      | ✅            | Restored to existing plans                                                                                                            |
| Planner tasks                 | ✅      | ✅            | Full task details and assignments                                                                                                     |
| OneNote notebooks             | ✅      | ✅            | Not included by default, add `Notes` to the included user/group types                                                                 |
| OneNote sections              | ✅      | ✅            | Including section groups                                                                                                              |
| OneNote pages                 | ✅      | ✅            | HTML content                                                                                                                          |
| To-Do task lists              | ✅      | ✅            | Not included by default, add `Tasks` to the included user types                                                                       |
| To-Do tasks                   | ✅      | ✅            | Including checklist items                                                                                                             |
| User profile                  | ✅      | ✅            | Photo and editable properties                                                                                                         |
| User chats                    | ✅      | ❌            | Backup only. Chats can be restored to a local disk, but not into a tenant                                                             |
| Chat messages                 | ✅      | ❌            | Backup only, including hosted content (images)                                                                                        |
| Teams channels                | ✅      | ✅            | Standard and private channels                                                                                                         |
| Channel messages              | ✅      | ✅            | Including replies. Restored in migration mode, preserving sender and timestamp                                                        |
| Channel tabs                  | ✅      | ✅            | Tab configuration preserved                                                                                                           |
| Team apps                     | ✅      | ✅            | App installation restored                                                                                                             |
| Group conversations           | ✅      | ⚠️           | <p>Threads and posts<br>Restore requires MS whitelist</p>                                                                             |
| Group calendar                | ❌      | ❌            | Not supported. The Graph API only allows group calendar access with delegated permissions                                             |
| Group members                 | ✅      | ✅            | Membership restored                                                                                                                   |
| Group owners                  | ✅      | ✅            | Ownership restored                                                                                                                    |
| Group settings                | ✅      | ✅            | Configuration properties                                                                                                              |
| SharePoint sites              | ✅      | ✅            | Document libraries, including subsites beneath site collections                                                                       |
| SharePoint lists              | ✅      | ✅            | Including list items                                                                                                                  |
| List item attachments         | ✅      | ✅            | File attachments                                                                                                                      |
| Shared mailboxes              | ✅      | ✅            | Detected and enumerated within the tenant; excluded from license count unless licensed                                                |
| Entra ID users and groups     | ✅      | ✅            | Not included by default, add `Directory` to the included root types. From Canary 2.4.1.105                                            |
| Entra ID administrative units | ✅      | ✅            | Including members. Scoped role members are only restored when role assignments are                                                    |
| Entra ID app registrations    | ✅      | ⚠️           | Including service principals and permission grants. Secrets and certificate keys cannot be read, and have to be created again         |
| Entra ID roles                | ✅      | ⚠️           | Custom role definitions are restored. Role assignments are only restored with `--office365-directory-restore-role-assignments`        |
| Conditional Access            | ✅      | ⚠️           | Policies, named locations, authentication strengths and contexts. Policies that are recreated are left in report-only mode by default |
| Entra ID tenant policies      | ✅      | ❌            | Backup only. Includes the organization, domains, licenses, and tenant-wide policies                                                   |
| Entra ID devices              | ✅      | ❌            | Backup only. Devices have to be registered again                                                                                      |

### Backup and restore details by type

#### Email (Exchange Online)

**Backup**

* Emails exported as MIME (`.eml`) plus JSON metadata.
* Folder hierarchy captured and preserved.
* Attachments included in the MIME content.

**Restore**

* Emails restored to a **Restored** folder by default, a target folder can be specified.
* Original folder structure recreated within the target.
* Duplicate detection via `InternetMessageId`.
* Large emails handled via chunked upload.

#### OneDrive for Business

**Backup**

* Files downloaded with original content.
* Folder structure and metadata captured.
* Sharing permissions recorded.

**Restore**

* Files uploaded to the target drive.
* Large files (>4 MB) use upload sessions.
* Timestamps restored via `fileSystemInfo`.
* Permissions restored via the invite endpoint.

**Duplicate detection**

* Name + path matching
* Size comparison
* Hash comparison (QuickXorHash or SHA1)

#### Calendar (Outlook)

**Backup**

* Events exported as JSON.
* Recurrence patterns captured.
* Attachments backed up separately.

**Restore**

* Events created in a **Restored** calendar by default, a target calendar can be specified.
* Series master events restored first.
* Exception events linked to restored masters.

#### Contacts (Outlook)

**Backup**

* Contacts exported as JSON.
* Contact photos backed up separately.
* Folder hierarchy captured.

**Restore**

* Contacts created in a **Restored** folder by default, a target folder can be specified.
* Original folder structure recreated.
* Photos restored after contact creation.
* Duplicate detection by email/name.

#### Planner

**Backup**

* Plans, buckets, and tasks captured.
* Task details (description, checklist) included.
* Assignments and labels preserved.

**Restore**

* Plans must already exist (Graph API limitation).
* Buckets created in the target plan.
* Tasks restored with full details.

#### OneNote

{% hint style="info" %}
OneNote is not included in backups by default. Add `Notes` to `--office365-included-user-types` and/or `--office365-included-group-types` to include it.
{% endhint %}

**Backup**

* Notebooks, section groups, sections enumerated.
* Pages exported as HTML content.

**Restore**

* Notebooks created in the user’s OneDrive.
* Sections created within notebooks.
* Pages restored as HTML.

#### To-Do tasks

{% hint style="info" %}
To-Do is not included in backups by default. Add `Tasks` to `--office365-included-user-types` to include it.
{% endhint %}

**Backup**

* Task lists enumerated.
* Tasks with all properties captured.
* Checklist items and linked resources included.

**Restore**

* Task lists created.
* Tasks restored with properties.
* Checklist items restored.
* Linked resources restored.

#### Teams chats

**Backup**

* Chat conversations and members enumerated.
* Messages captured with content.
* Hosted content (images) backed up.
* Requires `Chat.Read.All`.

**Restore**

* Restoring chats into a tenant is not supported.
* Chats can be restored to a local disk for inspection.

#### Teams channels

**Backup**

* Standard and private channels enumerated.
* Channel properties captured.
* Messages and replies backed up.

**Restore**

* Channels created if not existing. Requires `Channel.Create`.
* Existing channels reused by name match.
* Messages and replies are imported in migration mode, which preserves the original sender and timestamp. Requires `Teamwork.Migrate.All`.
* The target channel is put into migration mode for the duration of the restore, and migration is completed when the restore finishes.
* Existing messages are read to avoid duplicates, matching on sender and timestamp. Requires `ChannelMessage.Read.All`.
* If the restore target is a team rather than a specific channel, and the original channel cannot be determined, messages are placed in a channel named "Restored".
* Hosted content (inline images) is not restored.

#### SharePoint

**Document libraries**

* Files and folders captured and restored similarly to OneDrive.
* Subsites beneath a site collection are included in the backup.

**Lists**

* Lists enumerated with schema.
* List items captured with attachments.
* Lists and items restored with field values and attachments.

#### Microsoft Entra ID directory

{% hint style="info" %}
Backup and restore of the Microsoft Entra ID directory is available from Canary 2.4.1.105. It is not included in backups by default. Add `Directory` to `--office365-included-root-types` to include it, and grant the [additional permissions](#microsoft-entra-id-directory-permissions) to the app registration.
{% endhint %}

The directory is the configuration of the tenant itself, as opposed to the content that users create. It is stored in a `directory` folder next to the `users`, `groups` and `sites` folders. The existing `users` and `groups` folders hold the content of each user and group, such as mail and files, while the `directory` folder holds the directory objects themselves, including the ones that have no content, such as security groups.

The directory is part of the Microsoft 365 backup license, and the objects in it do not count toward the license limit.

Use `--office365-included-directory-types` to choose which parts of the directory to include:

| Directory type        | Contents                                                                                                                                                      |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Organization`        | The organization settings, the domains, and the subscribed licenses                                                                                           |
| `Users`               | All user accounts, including guests, with their manager and directly assigned licenses                                                                        |
| `Groups`              | All groups, including security groups and distribution lists, with their members and owners                                                                   |
| `AdministrativeUnits` | Administrative units with their members and scoped role members                                                                                               |
| `Roles`               | Role definitions, role assignments, eligible and time-bound assignments from Privileged Identity Management, and the role management policies                 |
| `Applications`        | App registrations with their owners and federated credentials, service principals with their owners and app role assignments, and delegated permission grants |
| `ConditionalAccess`   | Conditional Access policies, named locations, authentication strengths and authentication contexts                                                            |
| `Policies`            | The tenant-wide policies, such as the authorization, authentication methods, cross-tenant access, token lifetime and app management policies                  |
| `Devices`             | Registered and joined devices with their owners and users                                                                                                     |

**Backup**

* Each object is stored as a JSON file named after the ID of the object. An object with related items, such as the members and owners of a group, is stored as a folder named after the ID, with a separate JSON file for each kind of related item.
* The directory is read again in full for each backup. Objects that have not changed do not take up additional space in the backup.
* If a part of the directory cannot be read because a permission is missing, a warning is logged and that part is left out of the backup, while the rest is backed up.
* If the tenant does not have the license for a feature, that part is left out of the backup with an information message instead of a warning, as there is nothing of that kind to back up. Privileged Identity Management, which covers the eligible and time-bound role assignments and the role management policies, requires Microsoft Entra ID P2 or Microsoft Entra ID Governance. Conditional Access requires Microsoft Entra ID P1.
* Secrets cannot be read through the Graph API, so user passwords, client secrets, and the private keys of certificates are not part of the backup.

**Restore**

* The restore target must be the `directory` folder of a tenant. Directory items cannot be restored into a user, group or site.
* An object that exists in the tenant is updated with the properties from the backup. Use `--office365-ignore-existing` to leave existing objects untouched.
* An object that was deleted, and is still among the deleted items of the tenant, is brought back with its original ID and then updated.
* An object that no longer exists is created again and gets a new ID. References to it from other objects in the same restore, such as memberships, are updated to the new ID.
* The restore only adds. Members, owners and assignments that exist in the tenant, but are not in the backup, are left in place, and properties that are empty in the backup are not cleared in the tenant.
* A user that is created again gets a random password, which is not written to the log. An administrator has to reset the password before the account can be used.
* An app registration that is created again gets a new application (client) ID, and its secrets and certificates have to be created again.
* The directory is restored before the content, so that a user or group that is created again can receive its content in the same restore.

{% hint style="warning" %}
A Conditional Access policy that refers to accounts or locations that have changed since the backup was made can lock every user out of the tenant. For this reason, a policy that has to be created or brought back from the deleted items is left in **report-only** mode, and a policy that still exists keeps its current state. Review the restored policies and enable them manually, or set `--office365-directory-keep-conditional-access-state` to restore the policies with the state they had in the backup.
{% endhint %}

{% hint style="warning" %}
Role assignments grant privileges that may have been removed on purpose since the backup was made. They are not restored unless `--office365-directory-restore-role-assignments` is set. The option covers role assignments, eligible role assignments, and the scoped role members of administrative units. Custom role definitions are restored without the option, as a definition does not grant anything by itself.
{% endhint %}

**Not restored**

The following is included in the backup, and can be restored to a local disk for inspection, but is not written back to a tenant. The restore logs a warning with the number of items that were left out:

* The organization settings, domains and subscribed licenses.
* The tenant-wide policies and the role management policies.
* Time-bound active role assignments from Privileged Identity Management.
* Devices, which have to be registered or joined again.

The following objects are skipped with a warning for each object:

* Users and groups that are synchronized from an on-premises Active Directory, as they have to be changed there.
* Guest users that are no longer among the deleted items, as they have to be invited again.
* Distribution lists and mail-enabled security groups, as they cannot be created through the Graph API.
* Managed identities, as they are created by the Azure resource they belong to.

### Technical limitations

#### API limitations

| Limitation            | Description                               | Impact                                               |
| --------------------- | ----------------------------------------- | ---------------------------------------------------- |
| Chat restore          | Chats cannot be restored into a tenant    | Chats are backup only, restore to local disk instead |
| Channel message media | Cannot restore inline images              | Hosted content lost on restore                       |
| Group calendar        | Graph only supports delegated permissions | Group calendars cannot be backed up or restored      |
| Planner plan creation | Plans cannot be created via API           | Plans must pre-exist                                 |
| File versions         | Only current version backed up            | Historical versions not available                    |
| Soft-deleted items    | Not captured in backup                    | Recently deleted items excluded                      |
| Rate limiting         | Graph API throttling (429 responses)      | Automatic retry with backoff                         |

#### Types excluded by default

| Feature                               | Default  | How to enable                                                  |
| ------------------------------------- | -------- | -------------------------------------------------------------- |
| To-Do (user `Tasks`)                  | Excluded | Add `Tasks` to `--office365-included-user-types`               |
| OneNote (user `Notes`)                | Excluded | Add `Notes` to `--office365-included-user-types`               |
| OneNote (group `Notes`)               | Excluded | Add `Notes` to `--office365-included-group-types`              |
| Entra ID directory (root `Directory`) | Excluded | Add `Directory` to `--office365-included-root-types`           |
| Group calendar                        | Excluded | Not supported. The Graph API only allows delegated permissions |
| All others                            | Included | Remove the type from the included types to exclude it          |

#### Data fidelity limitations

{% hint style="info" %}
For restores into a Microsoft 365 tenant, data is technically "created again" as the API does not support restoring content. Visually the data looks the same but internal values, such as timestamps or references may be different in the restored version.
{% endhint %}

| Data type | Limitation                                                   |
| --------- | ------------------------------------------------------------ |
| Email     | Original message ID preserved, but internal Graph ID changes |
| Calendar  | Online meeting links preserved but not recreated             |
| Contacts  | Contact ID changes on restore                                |
| Files     | File ID changes; hash and timestamps preserved               |
| Messages  | Sender and timestamp preserved, but message ID changes       |

### API permissions reference

All permissions are Microsoft Graph **application permissions** granted to the app registration, and they require admin consent. Read permissions are only needed for backup. Restore requires the corresponding write permissions, and a granted write permission also covers its read counterpart, so an app registration used for both backup and restore only needs the restore list plus the backup-only Teams permissions.

Duplicati reads the granted permissions from the `roles` claim of the access token, so no additional Graph calls are needed to verify them.

#### Backup permissions

```
User.Read.All
Group.Read.All
Mail.Read
MailboxSettings.Read
Calendars.Read
Contacts.Read
Files.Read.All
Sites.Read.All
Notes.Read.All
Tasks.Read.All
TeamMember.Read.All
ChannelMessage.Read.All
Chat.Read.All
```

#### Restore permissions

```
User.ReadWrite.All
Group.ReadWrite.All
Mail.ReadWrite
MailboxSettings.ReadWrite
Calendars.ReadWrite
Contacts.ReadWrite
Files.ReadWrite.All
Sites.ReadWrite.All
Notes.ReadWrite.All
Tasks.ReadWrite.All
Channel.Create
ChannelMessage.Read.All
Teamwork.Migrate.All
```

{% hint style="info" %}
The Teams-specific permissions `Team.ReadBasic.All`, `Channel.ReadBasic.All`, `TeamsTab.Read.All`, `TeamsAppInstallation.ReadForTeam.All`, `TeamsTab.ReadWrite.All`, and `TeamsAppInstallation.ReadWriteForTeam.All` are the least-privileged permissions for reading teams, channels, tabs, and installed apps, and for creating tabs and installing apps. They are not required, because Microsoft Graph also accepts `Group.Read.All` / `Group.ReadWrite.All` for those endpoints, and the group permissions are already needed for group backup and restore.
{% endhint %}

{% hint style="info" %}
Channel messages are restored in migration mode, which requires `Teamwork.Migrate.All`. `ChannelMessage.Read.All` is required for both backup and restore, because the restore reads existing messages to detect duplicates. `Chat.Read.All` is only needed for backup, as user chats cannot be restored into a tenant.
{% endhint %}

#### Microsoft Entra ID directory permissions

These permissions are only needed if `Directory` is added to `--office365-included-root-types`, which is possible from Canary 2.4.1.105. They are granted in addition to the permissions above, and the permission check only reports them when the `Directory` root type is included.

For backup:

```
Directory.Read.All
Policy.Read.All
Policy.Read.PermissionGrant
RoleManagement.Read.Directory
```

For restore:

```
User.DeleteRestore.All
AdministrativeUnit.ReadWrite.All
Application.ReadWrite.All
AppRoleAssignment.ReadWrite.All
DelegatedPermissionGrant.ReadWrite.All
Policy.ReadWrite.ConditionalAccess
RoleManagement.ReadWrite.Directory
```

An app registration used for both backup and restore needs both lists, except `RoleManagement.Read.Directory`, which is covered by `RoleManagement.ReadWrite.Directory`. Restoring users and groups in the directory uses `User.ReadWrite.All` and `Group.ReadWrite.All` from the regular restore permissions.

{% hint style="danger" %}
The restore permissions for the directory are highly privileged. An application with `RoleManagement.ReadWrite.Directory`, `Application.ReadWrite.All` or `AppRoleAssignment.ReadWrite.All` can grant itself any role or permission in the tenant, including Global Administrator. Use a separate app registration for restore, and grant these permissions only for the time it takes to restore.
{% endhint %}

| Permission                               | Backup | Restore | Used for                                                                                                           |
| ---------------------------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------ |
| `Directory.Read.All`                     | ✅      |         | Read users, groups, administrative units, roles, app registrations, service principals, and devices                |
| `Policy.Read.All`                        | ✅      |         | Read Conditional Access policies, named locations, and the tenant-wide policies                                    |
| `Policy.Read.PermissionGrant`            | ✅      |         | Read the permission grant policies, which `Policy.Read.All` does not cover                                         |
| `RoleManagement.Read.Directory`          | ✅      |         | Read eligible and time-bound role assignments and the role management policies                                     |
| `User.DeleteRestore.All`                 |        | ✅       | Bring back deleted users from the deleted items                                                                    |
| `AdministrativeUnit.ReadWrite.All`       |        | ✅       | Create and update administrative units and their members                                                           |
| `Application.ReadWrite.All`              |        | ✅       | Create, update, and bring back app registrations and service principals                                            |
| `AppRoleAssignment.ReadWrite.All`        |        | ✅       | Restore app role assignments                                                                                       |
| `DelegatedPermissionGrant.ReadWrite.All` |        | ✅       | Restore delegated permission grants                                                                                |
| `Policy.ReadWrite.ConditionalAccess`     |        | ✅       | Create, update, and bring back Conditional Access policies, named locations, authentication strengths and contexts |
| `RoleManagement.ReadWrite.Directory`     |        | ✅       | Create custom role definitions, role assignments, and groups that can be assigned to roles                         |

#### Permission details

| Permission                  | Backup | Restore | Used for                                                                             |
| --------------------------- | ------ | ------- | ------------------------------------------------------------------------------------ |
| `User.Read.All`             | ✅      |         | Read user accounts, profiles, photos, and license assignments                        |
| `User.ReadWrite.All`        |        | ✅       | Update user profiles, such as restoring the profile photo                            |
| `Group.Read.All`            | ✅      |         | Read groups, their members, owners, and conversations                                |
| `Group.ReadWrite.All`       |        | ✅       | Create groups, and manage members, owners, and conversations                         |
| `Mail.Read`                 | ✅      |         | Read mailbox folders, messages, attachments, and inbox rules                         |
| `Mail.ReadWrite`            |        | ✅       | Create and update mailbox folders, messages, attachments, and inbox rules            |
| `MailboxSettings.Read`      | ✅      |         | Read user mailbox settings                                                           |
| `MailboxSettings.ReadWrite` |        | ✅       | Update user mailbox settings                                                         |
| `Calendars.Read`            | ✅      |         | Read user calendars and events                                                       |
| `Calendars.ReadWrite`       |        | ✅       | Create and update calendars, events, and event attachments                           |
| `Contacts.Read`             | ✅      |         | Read contact folders and contacts                                                    |
| `Contacts.ReadWrite`        |        | ✅       | Create and update contact folders, contacts, and contact photos                      |
| `Files.Read.All`            | ✅      |         | Read OneDrive drives, files, and sharing permissions                                 |
| `Files.ReadWrite.All`       |        | ✅       | Create and update OneDrive files and sharing permissions                             |
| `Sites.Read.All`            | ✅      |         | Read SharePoint sites, lists, and list items                                         |
| `Sites.ReadWrite.All`       |        | ✅       | Create and update SharePoint sites, lists, and list items                            |
| `Notes.Read.All`            | ✅      |         | Read OneNote notebooks, sections, and pages                                          |
| `Notes.ReadWrite.All`       |        | ✅       | Create and update OneNote notebooks, sections, and pages                             |
| `Tasks.Read.All`            | ✅      |         | Read Planner plans, buckets, tasks, and To Do lists                                  |
| `Tasks.ReadWrite.All`       |        | ✅       | Create and update Planner plans, buckets, tasks, and To Do lists                     |
| `TeamMember.Read.All`       | ✅      |         | Read team memberships                                                                |
| `Channel.Create`            |        | ✅       | Create channels when restoring                                                       |
| `ChannelMessage.Read.All`   | ✅      | ✅       | Read Teams channel messages and replies. Restore reads messages to detect duplicates |
| `Chat.Read.All`             | ✅      |         | Read Teams chat messages                                                             |
| `Teamwork.Migrate.All`      |        | ✅       | Restore Teams channels and channel messages in migration mode                        |

#### Permissions by data type

| Data type            | Backup (read)             | Restore (write)                                   |
| -------------------- | ------------------------- | ------------------------------------------------- |
| User email           | `Mail.Read`               | `Mail.ReadWrite`                                  |
| Email folders        | `Mail.Read`               | `Mail.ReadWrite`                                  |
| Mailbox rules        | `Mail.Read`               | `Mail.ReadWrite`                                  |
| Mailbox settings     | `MailboxSettings.Read`    | `MailboxSettings.ReadWrite`                       |
| User calendar        | `Calendars.Read`          | `Calendars.ReadWrite`                             |
| Calendar attachments | `Calendars.Read`          | `Calendars.ReadWrite`                             |
| User contacts        | `Contacts.Read`           | `Contacts.ReadWrite`                              |
| Contact folders      | `Contacts.Read`           | `Contacts.ReadWrite`                              |
| Contact photos       | `Contacts.Read`           | `Contacts.ReadWrite`                              |
| OneDrive files       | `Files.Read.All`          | `Files.ReadWrite.All`                             |
| OneDrive folders     | `Files.Read.All`          | `Files.ReadWrite.All`                             |
| File permissions     | `Files.Read.All`          | `Files.ReadWrite.All`                             |
| User profile         | `User.Read.All`           | `User.ReadWrite.All`                              |
| User photo           | `User.Read.All`           | `User.ReadWrite.All`                              |
| SharePoint sites     | `Sites.Read.All`          | `Sites.ReadWrite.All`                             |
| SharePoint lists     | `Sites.Read.All`          | `Sites.ReadWrite.All`                             |
| List items           | `Sites.Read.All`          | `Sites.ReadWrite.All`                             |
| Teams channels       | `Group.Read.All`          | `Channel.Create`                                  |
| Channel messages     | `ChannelMessage.Read.All` | `Teamwork.Migrate.All`, `ChannelMessage.Read.All` |
| Channel tabs         | `Group.Read.All`          | `Group.ReadWrite.All`                             |
| Team apps            | `Group.Read.All`          | `Group.ReadWrite.All`                             |
| Team memberships     | `TeamMember.Read.All`     | `Group.ReadWrite.All`                             |
| User chats           | `Chat.Read.All`           | Not supported                                     |
| Chat messages        | `Chat.Read.All`           | Not supported                                     |
| Group conversations  | `Group.Read.All`          | `Group.ReadWrite.All`                             |
| Group membership     | `Group.Read.All`          | `Group.ReadWrite.All`                             |
| Group settings       | `Group.Read.All`          | `Group.ReadWrite.All`                             |
| Group calendar       | Not supported             | Not supported                                     |
| Planner plans        | `Tasks.Read.All`          | `Tasks.ReadWrite.All`                             |
| Planner buckets      | `Tasks.Read.All`          | `Tasks.ReadWrite.All`                             |
| Planner tasks        | `Tasks.Read.All`          | `Tasks.ReadWrite.All`                             |
| OneNote notebooks    | `Notes.Read.All`          | `Notes.ReadWrite.All`                             |
| OneNote sections     | `Notes.Read.All`          | `Notes.ReadWrite.All`                             |
| OneNote pages        | `Notes.Read.All`          | `Notes.ReadWrite.All`                             |
| To-Do task lists     | `Tasks.Read.All`          | `Tasks.ReadWrite.All`                             |
| To-Do tasks          | `Tasks.Read.All`          | `Tasks.ReadWrite.All`                             |

### Data format and storage

#### Backup data formats

| Data type       | Format   | Extension            |
| --------------- | -------- | -------------------- |
| Email content   | MIME     | `.eml`               |
| Email metadata  | JSON     | `.json`              |
| Calendar events | JSON     | `.json`              |
| Contacts        | JSON     | `.json`              |
| Contact photos  | Binary   | `.photo`             |
| Files           | Original | (original extension) |
| OneNote pages   | HTML     | `.html`              |
| All metadata    | JSON     | `.json`              |

#### Metadata structure

Each backed-up item includes metadata with common properties:

```json
{
    "o365:Type": "SourceItemType",
    "o365:Id": "Graph API ID",
    "o365:Name": "Display name",
    "o365:CreatedDateTime": "ISO 8601 timestamp",
    "o365:LastModifiedDateTime": "ISO 8601 timestamp"
}
```

#### Storage requirements

* Email: MIME content + JSON metadata per message
* Files: Original file size + metadata overhead
* Calendar: JSON per event (typically 1–10 KB)
* Contacts: JSON per contact (typically 1–5 KB)

### Cross-tenant restore

#### Supported scenarios

| Scenario                         | Supported | Notes                           |
| -------------------------------- | --------- | ------------------------------- |
| Same user, same tenant           | ✅         | Default restore behavior        |
| Different user, same tenant      | ✅         | Use `--restore-path`            |
| Same user, different tenant      | ✅         | Requires credentials for target |
| Different user, different tenant | ✅         | Full cross-tenant restore       |

#### Cross-tenant considerations

1. **User mapping**: Users referenced in data (assignments, sharing) must exist in the target tenant.
2. **Group mapping**: Groups must exist in the target tenant for group-related restores.
3. **App availability**: Teams apps must be available in the target tenant’s app catalog.
4. **Permission scope**: Application must have permissions in the target tenant.

#### Restore path syntax

If not using the UI to pick the destination, the commandline syntax looks like this:

```
--restore-path="@office365://users/{target-user-id}?office365-tenant-id=..."
--restore-path="@office365://groups/{target-group-id}?office365-tenant-id=..."
--restore-path="@office365://sites/{target-site-id}?office365-tenant-id=..."
```

The Microsoft Entra ID directory is restored to the `directory` folder of the tenant, and the options for the directory restore are added to the same URL:

```
--restore-path="@office365://directory?office365-tenant-id=...&office365-directory-restore-role-assignments=true"
```

### Best practices

#### Backup recommendations

1. Enable metadata storage with `--store-metadata-content-in-database`.
2. Schedule regular backups.
3. Verify required permissions before backup.

#### Restore recommendations

1. Test restore procedures regularly.
2. Verify target user/group exists before restore.
3. Use `--office365-ignore-existing` carefully; default behavior skips duplicates.
4. Review restored sharing permissions.
5. Be aware of limitations when restoring into a tenant.

#### Security considerations

1. Store client secrets securely.
2. Prefer certificates over secrets in production.
3. Request only the permissions you need.
4. Monitor backup/restore operations with audit logging.

### References

* [Microsoft Graph Permissions Reference](https://docs.microsoft.com/en-us/graph/permissions-reference)
* [Azure AD App Registration](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app)


---

# 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.duplicati.com/automation-and-integration/office-365-backup-and-restore.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.
