Skip to content

Azure Files

OneDrive and SharePoint files and list items from Microsoft 365

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/azure-files/index.md to help me query Azure Files with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

List the files in a document library

Replace the sample drive identifier with the ID of your document library.

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT id, name, size, web_url
FROM azure.main.drive_items('<driveId>')
WHERE _row_kind IS NULL

Quick start

Choose where to run Azure Files, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'azure' AS azure (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-azure-files'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

azure_graph credentials

Microsoft Entra app-only (client-credentials) credentials for Microsoft Graph

Get these credentials →
secret.sql
CREATE SECRET azure_graph (
    TYPE azure_graph,
    tenant_id     '<tenant_id>',
    client_id     '<client_id>',
    client_secret '<AZURE_GRAPH_CLIENT_SECRET>'  -- secret
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT id, name, size, web_url
FROM azure.main.drive_items('<driveId>')
WHERE _row_kind IS NULL
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'azure' AS azure (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

Microsoft 365 content (OneDrive / SharePoint driveItems + listItems) via Graph per-resource delta — vgi-azure-files. v1 least-privilege: Sites.Selected (opt-in Sites.Read.All for fleet scans).

Catalog

Everything azure exposes once attached — read straight from the worker's released build.

azure 1 schema
main 1 view · 2 functions

Microsoft 365 content (OneDrive / SharePoint driveItems + SharePoint listItems) as incremental Graph delta feeds.

Schema examples (5)
Examples (5)

Full sync of a document library's files (data rows only)

SELECT id, name, size, web_url
FROM azure.main.drive_items('<driveId>')
WHERE _row_kind IS NULL;

Incremental sync of a drive from a saved cursor (upserts and removals)

SELECT id, change_type, name
FROM azure.main.drive_items('<driveId>', delta_token := '<@odata.deltaLink>');

Include the opt-in short-lived download capability URL

SELECT id, name, _download_url
FROM azure.main.drive_items('<driveId>', include_download_url := true)
WHERE _row_kind IS NULL AND change_type = 'upsert';

Full sync of a SharePoint list's items

SELECT id, name, web_url, last_modified_date_time
FROM azure.main.sharepoint_list_items('<siteId>', '<listId>')
WHERE _row_kind IS NULL;
1 more example

Read the delta cursor to persist for a drive's next sync

SELECT _delta_next
FROM azure.main.drive_items('<driveId>')
WHERE _row_kind = 'marker';
Views
content_collections 2 examples4 cols

The Microsoft 365 content collections this catalog exposes (document-library drive items, SharePoint list items) and the delta table function that serves each. Browsable without credentials.

Columns
collection VARCHAR
The collection slug (drive_items / list_items).
resource VARCHAR
The singular Microsoft Graph resource type the collection contains (driveItem / listItem).
table_function VARCHAR
The catalog table function that syncs this collection as a delta feed.
description VARCHAR
A one-line description of the collection.
Examples (2)

List every content collection and the table function that serves it

SELECT collection, table_function
FROM azure.main.content_collections
ORDER BY collection;

Find the table function for a given Graph resource type

SELECT table_function
FROM azure.main.content_collections
WHERE resource = 'listItem';
Link
Table functions
drive_items (drive VARCHAR, delta_token := VARCHAR, include_download_url := BOOLEAN, page_size := BIGINT, select_fields := VARCHAR) 4 examples

OneDrive / SharePoint document-library driveItems via Microsoft Graph per-drive delta (incremental change feed with removals). One delta_token per drive; the {drive -> deltaLink} map is held by the caller (multi-cursor). include_download_url is opt-in only (capability URL).

Positional arguments
drive VARCHAR
REQUIRED. The Microsoft Graph drive id of the OneDrive / SharePoint document library to scan (the `driveId`).
Named arguments
delta_token := VARCHAR
A previously persisted `@odata.deltaLink` (the `_delta_next` value from a prior scan's marker row for THIS drive), replayed verbatim to return only what changed since. Empty (the default) performs a full sync. · default ""
include_download_url := BOOLEAN
Opt-in only. When `true`, adds a `_download_url` column carrying a short-lived, pre-authed, no-bearer capability URL for each live file row (never folders or removed tombstones). Omitted from the schema entirely when `false` (the default) — SECURITY: this URL bypasses RBAC if leaked. · default false
page_size := BIGINT
Best-effort Microsoft Graph `$top` page size for the initial full sync (Graph may not honor it). Defaults to 200. · default 200
select_fields := VARCHAR
Comma-separated Microsoft Graph `$select` projection of driveItem fields to fetch on the initial full sync. Pinned for the life of a delta token (baked into the server's deltaLink). Defaults to `id,name,size,webUrl,lastModifiedDateTime`. (Named `select_fields` rather than `select` because `select` is a reserved SQL keyword and cannot be used bare as a named argument.) · default "id,name,size,webUrl,lastModifiedDateTime"
Returns columns
id VARCHAR
The item's id. NULL on the marker row.
change_type VARCHAR
`upsert` (created/updated) or `removed` (deleted). NULL on the marker row.
removed_reason VARCHAR
For removed rows, the `@removed.reason` (`changed` or `deleted`); NULL otherwise.
name VARCHAR
The item's name (file/folder name, or the list item's Title). NULL on removed tombstones and the marker row.
size BIGINT
The item's size in bytes. NULL for folders, removed tombstones, and the marker row.
web_url VARCHAR
Browser URL to the item. NULL on removed tombstones and the marker row.
last_modified_date_time VARCHAR
ISO 8601 last-modified timestamp. NULL on removed tombstones and the marker row.
_row_kind VARCHAR
NULL for data rows; `marker` for the single trailing cursor row.
_delta_next VARCHAR
On the marker row, the verbatim `@odata.deltaLink` to persist and replay as this resource's next cursor; NULL on data rows.
id VARCHAR
The item's id. NULL on the marker row.
change_type VARCHAR
`upsert` (created/updated) or `removed` (deleted). NULL on the marker row.
removed_reason VARCHAR
For removed rows, the `@removed.reason` (`changed` or `deleted`); NULL otherwise.
name VARCHAR
The item's name (file/folder name, or the list item's Title). NULL on removed tombstones and the marker row.
size BIGINT
The item's size in bytes. NULL for folders, removed tombstones, and the marker row.
web_url VARCHAR
Browser URL to the item. NULL on removed tombstones and the marker row.
last_modified_date_time VARCHAR
ISO 8601 last-modified timestamp. NULL on removed tombstones and the marker row.
_download_url VARCHAR
Only present when `include_download_url := true`. A short-lived, pre-authed, no-bearer download capability URL for live file rows; NULL for folders, removed tombstones, and the marker row.
_row_kind VARCHAR
NULL for data rows; `marker` for the single trailing cursor row.
_delta_next VARCHAR
On the marker row, the verbatim `@odata.deltaLink` to persist and replay as this resource's next cursor; NULL on data rows.
Returns columns · depends on the arguments
Default (`include_download_url := false`)
id VARCHAR
The item's id. NULL on the marker row.
change_type VARCHAR
`upsert` (created/updated) or `removed` (deleted). NULL on the marker row.
removed_reason VARCHAR
For removed rows, the `@removed.reason` (`changed` or `deleted`); NULL otherwise.
name VARCHAR
The item's name (file/folder name, or the list item's Title). NULL on removed tombstones and the marker row.
size BIGINT
The item's size in bytes. NULL for folders, removed tombstones, and the marker row.
web_url VARCHAR
Browser URL to the item. NULL on removed tombstones and the marker row.
last_modified_date_time VARCHAR
ISO 8601 last-modified timestamp. NULL on removed tombstones and the marker row.
_row_kind VARCHAR
NULL for data rows; `marker` for the single trailing cursor row.
_delta_next VARCHAR
On the marker row, the verbatim `@odata.deltaLink` to persist and replay as this resource's next cursor; NULL on data rows.
With `include_download_url := true`
id VARCHAR
The item's id. NULL on the marker row.
change_type VARCHAR
`upsert` (created/updated) or `removed` (deleted). NULL on the marker row.
removed_reason VARCHAR
For removed rows, the `@removed.reason` (`changed` or `deleted`); NULL otherwise.
name VARCHAR
The item's name (file/folder name, or the list item's Title). NULL on removed tombstones and the marker row.
size BIGINT
The item's size in bytes. NULL for folders, removed tombstones, and the marker row.
web_url VARCHAR
Browser URL to the item. NULL on removed tombstones and the marker row.
last_modified_date_time VARCHAR
ISO 8601 last-modified timestamp. NULL on removed tombstones and the marker row.
_download_url VARCHAR
Only present when `include_download_url := true`. A short-lived, pre-authed, no-bearer download capability URL for live file rows; NULL for folders, removed tombstones, and the marker row.
_row_kind VARCHAR
NULL for data rows; `marker` for the single trailing cursor row.
_delta_next VARCHAR
On the marker row, the verbatim `@odata.deltaLink` to persist and replay as this resource's next cursor; NULL on data rows.
Examples (4)

Full sync of a document library's files (data rows only)

SELECT id, name, size, web_url
FROM azure.main.drive_items('<driveId>')
WHERE _row_kind IS NULL;

Incremental sync replaying a previously saved delta cursor for this drive

SELECT id, change_type, name
FROM azure.main.drive_items('<driveId>', delta_token := '<@odata.deltaLink>');

Fetch files with the opt-in short-lived download capability URL

SELECT id, name, _download_url
FROM azure.main.drive_items('<driveId>', include_download_url := true)
WHERE _row_kind IS NULL AND change_type = 'upsert';
1 more example

Read the delta cursor to persist for this drive's next sync

SELECT _delta_next
FROM azure.main.drive_items('<driveId>')
WHERE _row_kind = 'marker';
Link
sharepoint_list_items (site VARCHAR, list VARCHAR, delta_token := VARCHAR, expand := VARCHAR, page_size := BIGINT) 3 examples

SharePoint listItems via Microsoft Graph per-list delta (incremental change feed with removals; $expand=fields materializes user-defined columns). One delta_token per (site,list); the {list -> deltaLink} map is held by the caller (multi-cursor).

Positional arguments
site VARCHAR
REQUIRED. The Microsoft Graph SharePoint site id whose list is scanned (the `siteId`).
list VARCHAR
REQUIRED. The Microsoft Graph list id of the SharePoint list to scan (the `listId`), within `site`.
Named arguments
delta_token := VARCHAR
A previously persisted `@odata.deltaLink` (the `_delta_next` value from a prior scan's marker row for THIS list), replayed verbatim to return only what changed since. Empty (the default) performs a full sync. · default ""
expand := VARCHAR
Microsoft Graph `$expand` clause for the initial full sync. Defaults to `fields`, which materializes the list's user-defined columns (the item Title maps to the `name` column). · default "fields"
page_size := BIGINT
Best-effort Microsoft Graph `$top` page size for the initial full sync (Graph may not honor it). Defaults to 200. · default 200
Returns columns
id VARCHAR
The item's id. NULL on the marker row.
change_type VARCHAR
`upsert` (created/updated) or `removed` (deleted). NULL on the marker row.
removed_reason VARCHAR
For removed rows, the `@removed.reason` (`changed` or `deleted`); NULL otherwise.
name VARCHAR
The item's name (file/folder name, or the list item's Title). NULL on removed tombstones and the marker row.
size BIGINT
The item's size in bytes. NULL for folders, removed tombstones, and the marker row.
web_url VARCHAR
Browser URL to the item. NULL on removed tombstones and the marker row.
last_modified_date_time VARCHAR
ISO 8601 last-modified timestamp. NULL on removed tombstones and the marker row.
_row_kind VARCHAR
NULL for data rows; `marker` for the single trailing cursor row.
_delta_next VARCHAR
On the marker row, the verbatim `@odata.deltaLink` to persist and replay as this resource's next cursor; NULL on data rows.
Examples (3)

Full sync of a SharePoint list's items (data rows only)

SELECT id, name, web_url, last_modified_date_time
FROM azure.main.sharepoint_list_items('<siteId>', '<listId>')
WHERE _row_kind IS NULL;

Incremental sync replaying a previously saved delta cursor for this list

SELECT id, change_type, name
FROM azure.main.sharepoint_list_items('<siteId>', '<listId>', delta_token := '<@odata.deltaLink>');

Read the delta cursor to persist for this list's next sync

SELECT _delta_next
FROM azure.main.sharepoint_list_items('<siteId>', '<listId>')
WHERE _row_kind = 'marker';
Link

Credentials

The secret type azure declares, as reported by the worker itself.

azure_graph

How to get these credentials

Microsoft Entra app-only (client-credentials) credentials for Microsoft Graph

secret.sql
CREATE SECRET azure_graph (
    TYPE azure_graph,
    tenant_id     '<tenant_id>',
    client_id     '<client_id>',
    client_secret '<AZURE_GRAPH_CLIENT_SECRET>'  -- secret
);
Key Type Required Description
tenant_id VARCHAR — Directory (tenant) ID of the Microsoft Entra tenant, from the app registration's Overview page
client_id VARCHAR — Application (client) ID of the Microsoft Entra app registration, from its Overview page
client_secret secret VARCHAR — Client secret value created under the app registration's Certificates & secrets page (shown once, at creation)

The worker doesn't mark which keys are required.

Needed by drive_itemssharepoint_list_items

Create the secret in the same session, after attaching azure — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

drive_items_bind_probe — Bind drive_items and expose its default result columns (credential-free; the 'drive' placeholder satisfies onBind, LIMIT 0 skips the network. Supply a real driveId and attach an azure_graph secret to sync).

SELECT id, name, size, web_url, last_modified_date_time
FROM azure.main.drive_items('placeholder-drive-id')
LIMIT 0;

Uses drive_items

drive_items_download_url_bind_probe — Bind drive_items with include_download_url := true to expose the opt-in _download_url capability column (credential-free; LIMIT 0 skips the network).

SELECT id, name, _download_url
FROM azure.main.drive_items('placeholder-drive-id', include_download_url := true)
LIMIT 0;

Uses drive_items

sharepoint_list_items_bind_probe — Bind sharepoint_list_items and expose its result columns (credential-free; the 'site'/'list' placeholders satisfy onBind, LIMIT 0 skips the network. Supply real siteId/listId and attach an azure_graph secret to sync).

SELECT id, name, web_url, last_modified_date_time
FROM azure.main.sharepoint_list_items('placeholder-site-id', 'placeholder-list-id')
LIMIT 0;

Uses sharepoint_list_items

Incremental sync of a drive from a saved cursor (upserts and removals)

SELECT id, change_type, name
FROM azure.main.drive_items('<driveId>', delta_token := '<@odata.deltaLink>')

Uses drive_items

Include the opt-in short-lived download capability URL

SELECT id, name, _download_url
FROM azure.main.drive_items('<driveId>', include_download_url := true)
WHERE _row_kind IS NULL AND change_type = 'upsert'

Uses drive_items

List every content collection and the table function that serves it

SELECT collection, table_function
FROM azure.main.content_collections
ORDER BY collection

Uses content_collections

5 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • After scanning a drive with drive_items, how do I get the cursor to use for the next incremental sync?
  • What kinds of Microsoft 365 content can I sync with this catalog, and which table function serves each?

Azure Files is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.