Microsoft 365¶
Backs up Exchange Online mailboxes, OneDrive, SharePoint sites, Teams channels and the Entra ID directory. Any fallbck-agent, Linux or Windows, can run these jobs as long as it has outbound HTTPS to login.microsoftonline.com and graph.microsoft.com.
1. Register the tenant¶
Under PBS Targets → Microsoft 365 Tenants (or inline in onboarding), add an Entra app registration with these read-only application permissions, and grant admin consent:
User.Read.All Group.Read.All Directory.Read.All
Policy.Read.All Application.Read.All Organization.Read.All
MailboxFolder.Read.All MailboxItem.Read.All MailboxItem.Export.All
MailboxSettings.Read Mail.Read Calendars.Read
Contacts.Read Files.Read.All Sites.Read.All
ChannelMessage.Read.All Team.ReadBasic.All Channel.ReadBasic.All
Authenticate with a client secret or a certificate. The secret or private key gets sealed on the server and handed to the agent per run with its backup ticket. Test gets a token from the server and reads /organization, so you know it works before the first run does.
Rather not have the server hold it at all? Pick Kept on the agents and read on.
Keep the credential on the agent¶
A credential profile keeps the secret or certificate in the agent's encrypted store (the same one database and Git profiles use). The server only learns the profile's name, tenant ID, client ID and expiry date. Create one on the agent that runs the job:
fallbck-agent m365 profile create --name contoso \
--tenant-id 72f988bf-86f1-41af-91ab-2d7cd011db47 \
--client-id 11111111-2222-3333-4444-555555555555 \
--ask-secret --expires 2027-06-30
# or with a certificate; the files are read at every run, so a renewed cert just works
fallbck-agent m365 profile create --name contoso --tenant-id ... --client-id ... \
--auth certificate --cert-file /etc/fallbck/m365.crt --key-file /etc/fallbck/m365.key
fallbck-agent m365 profile test --name contoso # gets a token from this host, reads /organization
fallbck-agent m365 profile list
--secret-file reads the secret from a file at every run instead, and --store-key copies a certificate and key into the store rather than reading the files. --expires is only for secrets: Entra doesn't tell an app when its own secret runs out, and a certificate's expiry is read from the cert.
Then put the profile's name in the job's Agent credential profile box. A few rules:
- The IDs have to match. The agent only uses a profile whose tenant and client IDs equal the tenant the job points at, and refuses the run otherwise. Write the tenant ID the same way in both places: GUID or domain, not one of each. That way a changed tenant on the server can't get the agent to use the profile for someone else's tenant.
- Tenants marked "Kept on the agents" hold no secret on the server, and every job on them needs a profile. You can't switch an existing tenant over while one of its jobs still uses the server's secret: set the profile on those jobs first.
- Test runs on the agent. The server's Test button can't check a credential it doesn't have, so it points you at
profile test. - Expiry warnings still work. The agent reports each profile's expiry, and its status page warns 30 days ahead. It also flags a job whose profile is missing or belongs to another tenant.
2. Create a job¶
Pick a tenant and the workloads: mailboxes, OneDrive, SharePoint, Teams messages (plus the team's files) and the directory. Several jobs can share one tenant, which is handy for splitting big tenants up.
Give the tenant its own namespace
Snapshots add up fast: one per user, site and team, every run. Clone a target into a dedicated namespace in onboarding, and give that namespace its own prune job.
What lands on PBS¶
Each run writes one snapshot per unit, each in its own group. The prefix is the job's group, which defaults to m365-<tenant name> (override with backup_id):
| Group | Archive | Contents |
|---|---|---|
host/<group>-user-<upn> |
user.pxar |
mailbox/, onedrive/ |
host/<group>-site-<host-path> |
site.pxar |
files/<library>/ |
host/<group>-team-<name> |
team.pxar |
messages/<channel>/<yyyy-mm>.json, hosted/, files/<library>/ |
host/<group> |
entra.pxar |
directory objects as JSON, RESTORE.md, plus fallbck-m365.json.blob |
A user who leaves the tenant keeps their history. One broken mailbox fails only that unit, not the run: the run ends Partial, lists the failed units, and the agent status page shows a warning.
Incrementals¶
After the first run only changed items get fetched. The agent keeps a per-unit index (Graph delta links, sizes, change keys) under <data_dir>/m365-state/<job>/. On pxar v2 targets, unchanged items are reused from the previous snapshot without even asking Graph.
Changed mailbox items get exported to the spool first, so size it for your biggest mailbox on the first run. Files stream straight from Graph.
About mailbox items¶
Mailbox items come out of the Graph mailbox export API as Exchange's own format (.exoitem). It's opaque, but each folder has an index.json with subject, sender and date. The catch:
- They can only go back into an Exchange Online mailbox (
createImportSession+importUrl), and that needsMailboxItem.ImportExport.All, which the backup app deliberately doesn't have. - Microsoft documents these APIs as a migration tool, not for backup, so they might change the terms.
Files and Teams messages are stored as-is.
Not covered¶
- Teams chats (it's a protected API)
- online archive mailboxes and public folders (Graph can't reach them)
- national clouds (the export API is global-only)