Query icon
Log icon
Schedule icon

Query a Microsoft Fabric Warehouse

Schedule T-SQL queries against a Microsoft Fabric Warehouse with Kestra. Authenticate with a service principal, store results, run data quality checks.

Categories
Data

Run a scheduled T-SQL query against a Microsoft Fabric Warehouse and land the result set in Kestra internal storage, ready for downstream tasks. This blueprint solves a common gap for Fabric teams: turning ad hoc Warehouse SQL into a reliable, observable, version-controlled pipeline that authenticates with a service principal, runs on a cron schedule, and hands results to alerting, exports, or transformations without manual clicks in the Fabric portal.

How it works

  1. The daily trigger (io.kestra.plugin.core.trigger.Schedule) fires every morning at 06:00 using the cron expression 0 6 * * *.
  2. The query_warehouse task (io.kestra.plugin.microsoft.fabric.warehouse.Query) authenticates to Fabric with a service principal (tenantId, clientId, clientSecret), connects to the Warehouse via sqlEndpointId and warehouseId, and runs the sql statement, here a 30 day revenue aggregation grouped by product category.
  3. With fetchType: STORE, the result set is written as an ION file to Kestra internal storage, which keeps memory flat regardless of row count.
  4. The notify task (io.kestra.plugin.core.log.Log) logs the row count and storage URI via {{ outputs.query_warehouse.size }} and {{ outputs.query_warehouse.uri }}.

What you get

  • A production ready, scheduled Fabric Warehouse query with service principal auth.
  • Results persisted to internal storage as ION, addressable by URI for downstream tasks.
  • Row count and storage URI surfaced in logs for quick verification.
  • A clean separation of query, storage, and notification you can extend.

Who it's for

  • Data engineers operationalizing Fabric Warehouse SQL.
  • Analytics engineers scheduling reporting and aggregation queries.
  • Platform teams centralizing orchestration across Microsoft and non Microsoft tools.

Why orchestrate this with Kestra

Fabric's built in scheduling runs pipelines inside Fabric, but it cannot easily react to external events, chain Warehouse results into Slack, email, S3, or dbt, or give you declarative YAML you keep in Git. Kestra adds event and schedule triggers, automatic retries, full execution lineage and replay, and a declarative definition you version control, filling the orchestration gap a Warehouse query engine alone leaves open.

Prerequisites

  • A Microsoft Fabric Warehouse with a SQL analytics endpoint.
  • An Entra ID service principal granted access to the Warehouse.
  • The sqlEndpointId and Warehouse item GUID (warehouseId).

Secrets

  • FABRIC_TENANT_ID: Entra ID tenant ID.
  • FABRIC_CLIENT_ID: service principal application (client) ID.
  • FABRIC_CLIENT_SECRET: service principal client secret.

Quick start

  1. Add FABRIC_TENANT_ID, FABRIC_CLIENT_ID, and FABRIC_CLIENT_SECRET as Kestra secrets.
  2. Set sql_endpoint_id (the server name prefix before .datawarehouse.fabric.microsoft.com) and warehouse_id (the Warehouse item GUID).
  3. Replace the sample sql with your own statement.
  4. Adjust the cron expression, then run the flow.

How to extend

  • Switch fetchType to FETCH for small in memory result sets, FETCH_ONE for scalar lookups, or NONE for DDL and DML statements.
  • Pipe the stored ION file to an export task (S3, GCS, email, Slack).
  • Replace the Schedule trigger with an event trigger to run on data arrival.
  • Add data quality assertions on outputs.query_warehouse.size and branch on failure.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.