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_urlfrom microsoft365_my_drive;
select name, id, drive_type, created_date_time, web_urlfrom 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_urlfrom microsoft365_my_drivewhere drive_type = 'personal';
select name, id, drive_type, created_date_time, web_urlfrom microsoft365_my_drivewhere 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_urlfrom microsoft365_my_drivewhere created_date_time <= current_date - interval '90 days';
select name, id, drive_type, created_date_time, web_urlfrom microsoft365_my_drivewhere 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_urlfrom microsoft365_my_drivewhere filter = 'name eq ''Steampipe''';
select name, id, drive_type, created_date_time, web_urlfrom microsoft365_my_drivewhere filter = 'name eq ''Steampipe''';
Schema for microsoft365_my_drive
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
created_by | jsonb | Identity of the user, device, or application which created the item. | |
created_date_time | timestamp with time zone | Date and time of item creation. | |
description | text | Provide a user-visible description of the drive. | |
drive_type | text | Describes 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. | |
etag | text | Specifies the eTag. | |
filter | text | Odata query to search for resources. | |
id | text | = | The unique identifier of the drive. |
last_modified_by | jsonb | Identity of the user, device, and application which last modified the item. | |
last_modified_date_time | timestamp with time zone | Date and time the item was last modified. | |
name | text | The name of the item. | |
parent_reference | jsonb | Parent information, if the drive has a parent. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tenant_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Azure Tenant ID where the resource is located. |
title | text | Title of the resource. | |
user_id | text | ID or email of the user. | |
web_url | text | URL 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