Operations
To learn about backup and restore from a video, click on the image below:

Backup
Microsoft 365 plugin backup configurations currently have one specific requirement in the Job resource. Below we show some examples.
Job Example
The only special requirement with M365 jobs is that Accurate mode backups must be disabled, as this feature is not supported at this time.
Job {
Name = m365-mytenant-backup
Fileset = fs-m365-email-all
Accurate = no
...
}
Fileset Examples
The plugin supports enough flexibility to configure almost any type of desired backup. Multiple Plugin= lines should not be spoecified in he Include section of a Fileset for the M365 Plugin.
Fileset examples for every supported service are linked below. For common purposes, the following two examples show how to configure an external config file or configure the number of threads:
Setup external config file:
Fileset {
Name = FS_M365_DRIVE
Include {
Options {
signature = MD5
}
Plugin = "m365: config_file=/opt/bacula/etc/m365.settings service=drive"
}
}
$ cat /opt/bacula/etc/m365.settings
tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc
objectid=56ddf1h9-eb5d-42nf-bac7-7b019fd284g5
Increase number of threads:
Fileset {
Name = fs-m365-email-adelev
Include {
Options {
signature = MD5
}
Plugin = "m365: service=email tenant=57uia43-d107-17a2-a2g2-aa53c10tdahc objectid=56ddf1h9-eb5d-
42nf-bac7-7b019fd284g5 user=adelev@baculaenterprise.onmicrosoft.com backup_threads=10"
}
}
More fileset examples for:
Restore
Restore operations are done using standard Bacula Enterprise bconsole commands.
The where parameter controls if the restore will be done locally to the File Daemon’s file system or to the Microsoft 365 service:
where=/ or empty value → Restore will be done over M365
where=/any/other/path → Restore will be done locally to the File Daemon file system
Restore options are described in the Restore parameters section of this document, so here we are going to simply show an example restore session, particularly this example is about OneDrive service:
*restore where=/
First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.
To select the JobIds, you have the following choices:
1: List last 20 Jobs run
2: List Jobs where a given File is saved
3: Enter list of comma separated JobIds to select
4: Enter SQL list command
5: Select the most recent backup for a client
6: Select backup for a client before a specified time
7: Enter a list of files to restore
8: Enter a list of files to restore before a specified time
9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Select object to restore
14: Cancel
Select item: (1-14): 5
Automatically selected Client: 127.0.0.1-fd
Automatically selected Fileset: FS_M365_DRIVE
+-------+-------+----------+-------------+---------------------+-------------------+
| jobid | level | jobfiles | jobbytes | starttime | volumename |
+-------+-------+----------+-------------+---------------------+-------------------+
| 11 | F | 190 | 332,978,505 | 2021-01-22 10:39:34 | TEST-2021-01-22:0 |
| 12 | I | 1 | 550 | 2021-01-22 10:43:05 | TEST-2021-01-22:0 |
+-------+-------+----------+-------------+---------------------+-------------------+
You have selected the following JobIds: 11,12
Building directory tree for JobId(s) 11,12 ... +++++++++++++++++++++++++++++++++++++++++++++++
188 files inserted into the tree.
You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.
cwd is: /
$ cd /@m365/baculaenterprise/adelev@baculaenterprise.onmicrosoft.com/drive/root:
cwd is: /@m365/baculaenterprise/adelev@baculaenterprise.onmicrosoft.com/drive/root:/
$ ls
Docs/
pluginTest.drive.deltaLink
sharedWithMe/
test4###v1.0_2020-11-25_153507.html
test4###v2.0_2020-11-25_153507.html
test4###v3.0_2020-12-02_180612.html
test4###v4.0_2020-12-02_180612.html
test4###v5.0_2020-12-03_134422.html
test4###v6.0_2020-12-02_180612.html
test4.html
testlink123###v1.0_2020-11-26_123244.url
testlink123###v2.0_2020-11-26_123244.url
testlink123###v3.0_2020-12-02_180613.url
testlink123###v4.0_2020-12-02_180613.url
testlink123.url
$ mark *
189 files marked.
$ done
Bootstrap records written to /tmp/regress/working/127.0.0.1-dir.restore.3.bsr
The Job will require the following (*=>InChanger):
Volume(s) Storage(s) SD Device(s)
===========================================================================
TEST-2021-01-22:0 File FileStorage
Volumes marked with "*" are in the Autochanger.
189 files selected to be restored.
Using Catalog "MyCatalog"
Run Restore job
JobName: RestoreFiles
Bootstrap: /tmp/regress/working/127.0.0.1-dir.restore.3.bsr
Where: /
Replace: Always
Fileset: Full Set
Backup Client: 127.0.0.1-fd
Restore Client: 127.0.0.1-fd
Storage: File
When: 2021-01-22 11:54:55
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): mod
Parameters to modify:
1: Level
2: Storage
3: Job
4: Fileset
5: Restore Client
6: When
7: Priority
8: Bootstrap
9: Where
10: File Relocation
11: Replace
12: JobId
13: Plugin Options
Select parameter to modify (1-13): 13
Automatically selected : m365: service=drive tenant="574dda43-d107-48e2-a7f2-aa51c10bdaec" objectid="31ddf4b1-
ed5d-432f-bac7-7b946fd23394" user="adelev@baculaenterprise.onmicrosoft.com" drive_version_history=yes debug=3
Plugin Restore Options
Option Current Value Default Value
destination_user: *None* (*None*)
destination_path: *None* (*None*)
send_report: *None* (0)
email_allow_duplicates: *None* (1)
drive_skip_sharedwithme: *None* (0)
drive_skip_versions: *None* (1)
drive_restore_share_permissions: *None* (0)
drive_send_invitations: *None* (0)
drive_invitations_message: *None* (*None*)
debug: *None* (*None*)
Use above plugin configuration? (yes/mod/no): mod
You have the following choices:
1: destination_user (Destination User)
2: destination_path (Destination Path in M365)
3: send_report (Send report of the restore operation to the affected user)
4: email_allow_duplicates (Allow Duplicate Emails)
5: drive_skip_sharedwithme (Skip restoring shared with me elements even if they are selected)
6: drive_skip_versions (Skip restoring file former versions (tagged with '###date') even if they are selected)
7: drive_restore_share_permissions (Restore share permissions of items so they are shared if they originally
were)
8: drive_send_invitations (Send email invitations for restored OneDrive shares)
9: drive_invitations_message (Set invitations message for restored OneDrive shares)
10: debug (Change debug level)
Select parameter to modify (1-10): 2
Please enter a value for destination_path: MY_RESTORE_PATH
Plugin Restore Options
Option Current Value Default Value
destination_user: *None* (*None*)
destination_path: MY_RESTORE_PATH (*None*)
send_report: *None* (0)
email_allow_duplicates: *None* (1)
drive_skip_sharedwithme: *None* (0)
drive_skip_versions: *None* (1)
drive_restore_share_permissions: *None* (0)drive_send_invitations: *None* (0)
drive_invitations_message: *None* (*None*)
debug: *None* (*None*)
Use above plugin configuration? (yes/mod/no): yes
Run Restore job
JobName: RestoreFiles
Bootstrap: /tmp/regress/working/127.0.0.1-dir.restore.3.bsr
Where: /
Replace: Always
Fileset: Full Set
Backup Client: 127.0.0.1-fd
Restore Client: 127.0.0.1-fd
Storage: File
When: 2021-01-22 11:54:55
Catalog: MyCatalog
Priority: 10
Plugin Options: User specified
OK to run? (yes/mod/no): yes
Job queued. JobId=14
Restore by Service
In this section some example restore configurations will be shown:
Cross-tenant Restore
You can perform cross-tenant restores using the restore variables: - tenantid - appid - objectid - secret
Obviously, it is needed to set up the destination tenant values, where one of the authentication methods should be applied first.
If you are using the standalone app authentication model, you will need to use the four values in your restore session.
If you want to use the common app authentication model, you won’t need to put the secret. On the other hand, please, ask the bacula enterprise edition support team in order to get the correct value for appid.
List
It is possible to list information using the bconsole .ls command and providing a path. In general, we need to provide the service parameter and a path representing a folder or object (like calendars).
There are some general commands (user, groups, sites), the rest of the commands need to point to the correct service.
Below some examples:
List general info: Users, groups, sites
Here we are showing these 3 commands using the bconsoel .ls command, but notice you may also use them with the query interface (keep your variable values, but apply something like: .query plugin=”…” client=xxxx parameter=xxx). Note that the referenced ‘config_file’ should contain the connection parameters (tenant, objectid, appid and secret).
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf" client=127.0.0.1-fd path=/user
Connecting to Client 127.0.0.1-fd at 127.0.0.1:8102
ptcomm: Starting Plugin Job
ptcomm: Finished reading Plugin Params
ptcomm: Backend connection to M365 stablished
ptcomm: Connected to tenant: baculaenterprise
ptcomm: Starting ListingStart
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /AdeleV@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /AlexW@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /DiegoS@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /jane@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /GradyA@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /HenriettaM@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /IsaiahL@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /JohannaL@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /JoniS@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /john@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /LeeG@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /LidiaH@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /LynneR@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /MeganB@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /MiriamG@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /NestorW@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /PattiF@baculaenterprise.onmicrosoft.com
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /PradeepG@baculaenterprise.onmicrosoft.com
2000 OK estimate files=18 bytes=0
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf"
client=127.0.0.1-fd path=/group
Connecting to Client 127.0.0.1-fd at 127.0.0.1:8102
ptcomm: Starting Plugin Job
ptcomm: Finished reading Plugin Params
ptcomm: Backend connection to M365 stablished
ptcomm: Connected to tenant: baculaenterprise
ptcomm: Starting ListingStart
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Contoso Team
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Dev Team
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /baculaenterprise
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /All Company
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Bacula Systems Team Site
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Dev people Group
2000 OK estimate files=6 bytes=0
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf"
client=127.0.0.1-fd path=/site
Connecting to Client 127.0.0.1-fd at 127.0.0.1:8102
ptcomm: Starting Plugin Job
ptcomm: Finished reading Plugin Params
ptcomm: Backend connection to M365 stablished
ptcomm: Connected to tenant: baculaenterprise
ptcomm: Starting ListingStart
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Communication site
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Adele Vance
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Alex Wilber
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Diego Siciliani
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Grady Archie
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Henrietta Mueller
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Isaiah Langer
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Johanna Lorenz
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Joni Sherman
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Lidia Holloway
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Lynne Robbins
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Megan Bowen
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Pradeep Gupta
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Bacula Systems Team Site
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Work @ Contoso
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Contoso Team
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Live @ Contoso
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Give @ Contoso
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Dev Team
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Dev people Group
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Team Site
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /John Doe
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Jane Doe
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Patti Fernandez
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Lee Gu
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Miriam Graham
-rw-r--r-- 1 root root -1 2106-02-07 07:28:15 /Nestor Wilke
2000 OK estimate files=28 bytes=0
# Query equivalents follow
*.query plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf" client=127.0.0.1-fd parameter=user
*.query plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf" client=127.0.0.1-fd parameter=group
*.query plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf" client=127.0.0.1-fd parameter=site
# Other similar query function
*.query plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf" client=127.0.0.1-fd parameter=team
The .query function to list users has an additional parameter that provides the function to filter the resulting user list by group. The parameter is called ‘q_users_group’ and it must be used inside the plugin line of the .query call. See the example below:
*.query client=example-fd plugin="m365: config_file=m365.conf q_users_group=groupName" parameter=user
Note
q_users_group is available since Bacula Enterprise 18.0.8.
List Onedrive contents
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=drive user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/
Connecting to Client 127.0.0.1-fd at 127.0.0.1:8102
m365: Starting Plugin Job
m365: Finished reading Plugin Params
m365: Connected to tenant: baculaenterprise
m365: Backend connection to M365 stablished
m365: Starting ListingStart
drwxr-xr-x 1 nobody nogroup 26800469 2020-11-08 01:34:35 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/root/
drwxr-xr-x 1 nobody nogroup 9876293 2020-12-03 15:28:31 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/
-rw-r----- 1 nobody nogroup 217873 2021-04-13 13:29:56 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Hats.JPG
-rw-r----- 1 nobody nogroup 1914266 2021-02-01 17:45:34 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/lombok.jar
-rw-r----- 1 nobody nogroup 785043 2021-02-01 17:45:56 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/noShared.dat
-rw-r----- 1 nobody nogroup 4 2021-02-01 17:45:35 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/test2.doc
-rw-r----- 1 nobody nogroup 4 2020-11-25 15:35:07 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/test4.html
-rw-r----- 1 nobody nogroup 42 2020-11-26 12:32:44 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/testlink123.url
drwxr-xr-x 1 nobody nogroup -1 2106-02-07 07:28:15 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/sharedWithMe/
2000 OK estimate files=23 bytes=53,600,938
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf
service=drive user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/sharedWithMe
Connecting to Client 127.0.0.1-fd at 127.0.0.1:8102
m365: Starting Plugin Job
m365: Finished reading Plugin Params
m365: Connected to tenant: baculaenterprise
m365: Backend connection to M365 stablished
m365: Starting ListingStart
-rw-r----- 1 nobody nogroup 11722 2021-04-13 17:42:06 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Aeque.ppt
-rw-r----- 1 nobody nogroup 4039 2021-04-13 17:42:02 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Voluptatibus.txt
-rw-r----- 1 nobody nogroup 7697 2021-04-13 17:41:59 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Nullam.jpeg
-rw-r----- 1 nobody nogroup 21031 2021-04-13 17:41:55 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Graeci.ppt
-rw-r----- 1 nobody nogroup 21417 2021-04-13 17:41:52 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Habeo.txt
-rw-r----- 1 nobody nogroup 15354 2021-04-13 17:41:47 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Atomorum.jpeg
-rw-r----- 1 nobody nogroup 22217 2021-04-13 17:41:43 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Faucibus.ppt
-rw-r----- 1 nobody nogroup 15714 2021-04-12 11:13:52 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Sodales.ppt
-rw-r----- 1 nobody nogroup 14371 2021-04-12 11:13:48 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Cum.txt
-rw-r----- 1 nobody nogroup 11059 2021-04-12 11:13:44 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Sapien.jpeg
-rw-r----- 1 nobody nogroup 14144 2021-04-12 11:13:41 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Habitasse.ppt
-rw-r----- 1 nobody nogroup 12594 2021-04-12 11:13:37 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Deserunt.txt
-rw-r----- 1 nobody nogroup 14923 2021-04-12 11:13:32 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Postulant.jpeg
-rw-r----- 1 nobody nogroup 21307 2021-04-12 11:13:29 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/SharePoint App/Tation.ppt
drwxr-xr-x 1 nobody nogroup 0 2021-01-08 14:32:20 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/john@baculaenterprise.onmicrosoft.
com/JohnFolder/
-rw-r----- 1 nobody nogroup 1442312 2021-01-08 11:57:09 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/john@baculaenterprise.onmicrosoft.
com/developers.pdf
-rw-r----- 1 nobody nogroup 630174 2021-01-08 11:57:08 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/sharedWithMe/john@baculaenterprise.onmicrosoft.
com/console.pdf
2000 OK estimate files=17 bytes=2,280,075*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf
service=drive user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/Docs
Connecting to Client 127.0.0.1-fd at 127.0.0.1:8102
m365: Starting Plugin Job
m365: Finished reading Plugin Params
m365: Connected to tenant: baculaenterprise
m365: Backend connection to M365 stablished
m365: Starting ListingStart
drwxr-xr-x 1 nobody nogroup 9876293 2020-12-03 15:28:31 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/
drwxr-xr-x 1 nobody nogroup 793475 2020-11-25 15:34:49 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/Simple Sub Folders/
-rw-r----- 1 nobody nogroup 6383460 2020-12-08 10:13:11 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/E16WKAMS.10E.zip
-rw-r----- 1 nobody nogroup 1914266 2020-12-08 10:13:32 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/lombok.jar
-rw-r----- 1 nobody nogroup 785043 2021-01-12 10:12:04 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/noShared.dat
-rw-r----- 1 nobody nogroup
24 2020-11-25 15:35:05 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/test1.txt
-rw-r----- 1 nobody nogroup 13 2021-01-11 15:39:57 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/test11.txt
-rw-r----- 1 nobody nogroup 4 2020-11-25 15:35:05 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/test2.doc
-rw-r----- 1 nobody nogroup 4 2020-11-25 15:35:05 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/test3.pdf
-rw-r----- 1 nobody nogroup 4 2020-12-03 16:52:32 /baculaenterprise/users
/adelev@baculaenterprise.onmicrosoft.com/drives/onedrive/root:/Docs/test4.html
2000 OK estimate files=10 bytes=19,752,586
Other list examples
Please note that the following examples are not available in .query mode, they are only for .ls command.
# List contents of Inbox folder of user adelev@baculaenterprise.onmicrosoft.com
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=email user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/Inbox
# List contents of Sent folder of user adelev@baculaenterprise.onmicrosoft.com
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=email user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/Sent
# List all contacts of user adelev@baculaenterprise.onmicrosoft.com
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=contacts user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/
# List contacts of user adelev@baculaenterprise.onmicrosoft.com and folder MyContactsDir
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=contacts user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/MyContactsDir
# List calendar events of user adelev@baculaenterprise.onmicrosoft.com and her calendar MyCalendar
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=calendar user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/MyCalendar
# List onenote pages of user adelev@baculaenterprise.onmicrosoft.com and her section secA included in section Group groupA
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=onenote user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/MyNotebook/sectionGroups/groupA/sections/secA
# List contents of OneDrive folder 'folderA' of user adelev@baculaenterprise.onmicrosoft.com
*.ls plugin="m365: config_file=/opt/bacula/etc/m365/exaple.tenant.conf service=drive user=adelev@baculaenterprise.onmicrosoft.com" client=127.0.0.1-fd path=/folderA
Performance command
This plugin provides a query command allowing to check the performance of a given setup. The process consist on uploading some randomly generated files of a customizable size (and a customizable number of them) to a target tenant, then download them using the same method the backup itself employs. Upload and download times are measured. An average is calculated and all the information is presented to the user.
Please, note that this command is currently working in single-threaded mode, while the plugin is running with multiple threads (configurable through concurrent_threads variable), so you could have better results with the actual backup process.
The usage of this command is:
*.query client=<your-client> plugin="m365: tenant=<tenantId> objectid=<objectId> user=<your-user> service=<service>" parameter=perf
Currently, theh plugin supports two types of performance commands: perf for onedrive (default) and perf for email. So the value service should be: drive or email.
The behavior of this service from performance perspective can differ significantly. Below we detail some important aspects:
On Onedrive and other services implying user files, it is needed to request a ‘download session’ for each file.
Once we have it, the download starts. This requires significantly more time than just retrieving simple objects.
In general, objects are not retrieved one by one. We request for lists of objects, that later on are processed.
For objects that are not pointing to any other file (as emails without attachments), the time needed per object is very low.
Drive perf command
For Onedrive service, in addition to user, you can also use group or site (site name or siteId) for this command. The final output will be similar to the following:
...
date=2021-09-06 17:25:56
tenant_name=johndoe.onmicrosoft.com
upload-speed-average=3.3 MiB/s
download-speed-average=32.2 MiB/s
latency-average=482.00 ms
console=---- Test END ----
You can control the size and the number of files used using the following query parameters: - q_perf_size (in bytes) - q_perf_files (number of files)
By default, their values are: - q_perf_size = 209715200 - q_perf_files = 3
Below we provide a usage example:
*.query client=127.0.0.1-fd plugin="m365:
tenant=f421f256-748a-4a80-90da-bf47y66fa166 objectid=90173rea-c144-46ye-8f93-4uh87bcd6d47 site=\"johndoe.sharepoint.com,fda66478-aab5-4896-a6ff-e0fb02af2a40,c024ee54-dcc0-4f1e-ab76-671f6eb87fda\" service=drive q_perf_files=5 q_perf_size=314572800" parameter=perf
Email perf command
For Email service, specifying a user is mandatory. The command can generate simple emails, but also emails with one attachment. The final output can be similar to the following:
...
console=---- Summary ----
date=2021-11-11 17:05:18
tenant_name=johndoe.onmicrosoft.com
upload-speed-average=44.6 KiB/s
download-speed-average=220.5 KiB/s
latency-average-per-list-call=510.83 ms
latency-average-per-message=36.18 ms
latency-average-attachments=617.64 ms
console=---- Test END ----
The behavior of the email perf command is a little different from the Onedrive one. Instead of uploading/downloading one message at a time, here everything is uploaded first. After that everything is downloaded. The reason is here the backup process uses lists of objects and, unless there are attachments implied, that’s all, the objects are simply stored from that list.
Similarly to the onedrive perf command, you can control the size and the number of emails. However, there is an extra parameter to control the size of the attachments:
q_perf_size (in bytes)
q_perf_size_attachments (in bytes)
If not specified, no attachment will be generated
If specified, one simple text attachment will be generated together with each email
q_perf_files (number of files)
By default, their values are:
q_perf_size = 10240
q_perf_size_attachments = 0
q_perf_files = 50
Below we provide a usage example:
*.query client=127.0.0.1-fd plugin="m365:
tenant=f421f256-748a-4a80-90da-bf47y66fa166 objectid=90173rea-c144-46ye-8f93-4uh87bcd6d47 site=\"johndoe.sharepoint.com,fda66478-aab5-4896-a6ff-e0fb02af2a40,c024ee54-dcc0-4f1e-ab76-671f6eb87fda\" service=email q_perf_size_attachment=204800" parameter=perf
Other query commands
Sometimes there is an element that causes some error while fetching it in the email service and it’s difficult to identify it by its reported debug id. For this situation, there is a decoding command:
As the example shows, the query parameter is ‘query=decode|{url}’. Url should be the URL until the element we are interested into (so the attachment here).
Another useful command shows all the options the plugin can accept as parameters, categorized by section:
The output of this command will return a json structure with all the available options.
Go back to Microsoft 365 (M365) Plugin article.