turbot/microsoft365
steampipe plugin install microsoft365

Table: microsoft365_my_drive - Query Microsoft 365 My Drives using SQL

My Drives in Microsoft 365 are personal storage spaces for users where they can store and share personal files, documents, and other data. Each user in Microsoft 365 has a dedicated My Drive, which is a part of the OneDrive for Business service. It is a cloud-based storage solution that allows users to access their files from any device, anywhere.

Table Usage Guide

The microsoft365_my_drive table provides insights into individual user drives in Microsoft 365. As a system administrator or security professional, you can utilize this table to explore the details of each user's personal drive, including the total storage space, used space, and the remaining space. This can be particularly useful for monitoring user storage usage, identifying potential storage issues, and ensuring compliance with storage policies.

Important Notes

  • If not authenticating with the Azure CLI, this table requires the user_id argument to be configured in the connection config.

Examples

Basic info

Explore which types of drives are being used in your Microsoft 365 environment and when they were created, to better understand your storage utilization and trends. This can help in optimizing resources and planning for future storage needs.

select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive;
select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive;

List personal drives

Explore which personal drives are available in your Microsoft 365 account. This can be useful for understanding how your storage is being utilized and for identifying any potential issues or misconfigurations.

select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive
where
drive_type = 'personal';
select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive
where
drive_type = 'personal';

List drives older than 90 days

Explore which drives in your Microsoft 365 account are older than 90 days. This can help identify outdated or potentially unused drives for cleanup or archival purposes.

select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive
where
created_date_time <= current_date - interval '90 days';
select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive
where
created_date_time <= date('now', '-90 day');

List drives using the filter

Explore the drives that are named 'Steampipe' to gain insights into their ID, type, creation date, and web URL. This can be useful for managing and organizing your digital resources efficiently.

select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive
where
filter = 'name eq ''Steampipe''';
select
name,
id,
drive_type,
created_date_time,
web_url
from
microsoft365_my_drive
where
filter = 'name eq ''Steampipe''';

Schema for microsoft365_my_drive

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
created_byjsonbIdentity of the user, device, or application which created the item.
created_date_timetimestamp with time zoneDate and time of item creation.
descriptiontextProvide a user-visible description of the drive.
drive_typetextDescribes the type of drive represented by this resource. OneDrive personal drives will return personal. OneDrive for Business will return business. SharePoint document libraries will return documentLibrary.
etagtextSpecifies the eTag.
filtertextOdata query to search for resources.
idtext=The unique identifier of the drive.
last_modified_byjsonbIdentity of the user, device, and application which last modified the item.
last_modified_date_timetimestamp with time zoneDate and time the item was last modified.
nametextThe name of the item.
parent_referencejsonbParent information, if the drive has a parent.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
tenant_idtext=, !=, ~~, ~~*, !~~, !~~*The Azure Tenant ID where the resource is located.
titletextTitle of the resource.
user_idtextID or email of the user.
web_urltextURL that displays the resource in the browser.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- microsoft365

You can pass the configuration to the command with the --config argument:

steampipe_export_microsoft365 --config '<your_config>' microsoft365_my_drive