Read capacity utilization and per-item CU from the Microsoft Fabric Capacity Metrics semantic model with fab, and start or pause a capacity. Invoke the fabric-cli skill alongside this one; its references/capacity-cost.md covers budget math, smoothing and throttling.
live (DirectQuery, CapacityMetricsCES connector):
CU Detail: per 30 s timepoint; Interactive, Background, CU limit, SKU
Timepoint CU Detail: same, per timepoint detail page
Metrics By Item [And Day|And Hour|And Operation]: CU (s), Duration (s), Operations, Users per item
System Events: pause, resume, state changes
import (fresh only after a model refresh; Pro workspace = 8 refreshes a day):
Capacities, Items, Workspaces, Timepoints/Dates calendars
Average utilization (last 1 hour | last 24 hours | last 7 days): measures on the Health page
not available: Azure Monitor has no metrics namespace for Microsoft.Fabric/capacities
Anything that must be current (a status bar, "what is using the capacity now") needs the DirectQuery tables.
The model sits in a Pro workspace, so there is no XMLA endpoint and te cannot connect. Use executeQueries through fab. DirectQuery tables need the capacity passed as an M parameter inside a DEFINE block; without it the connector fails, and the error reads like a credential problem.
fab api -A powerbi "groups/<metrics-ws-id>/datasets/<metrics-model-id>/executeQueries" -X post -i "$(jq -cn --arg q "$(cat <<'EOF'
DEFINE
MPARAMETER 'CapacitiesList' = {"<CAPACITY-ID-UPPERCASE>"}
VAR point = MINX(TOPN(2, 'CU Detail', 'CU Detail'[Window start time], DESC), 'CU Detail'[Window start time])
EVALUATE
ROW("pct", CALCULATE(
DIVIDE(SUM('CU Detail'[Interactive]) + SUM('CU Detail'[Background]), MAX('CU Detail'[Base capacity units]) * 30),
'CU Detail'[Window start time] = point) * 100)
EOF
)" '{queries: [{query: $q}]}')"
CU Detail values are CU-seconds per 30 s timepoint, already smoothed; utilization % = (Interactive + Background) / (Base capacity units * 30). CU limit is a ratio (1.0), not a denominatorfab api -A powerbi capacities
SUMMARIZECOLUMNS(Items[Workspace name], Items[Item kind], Items[Item name], TREATAS({DATE(y,m,d)}, 'Metrics By Item And Day'[Date]), "CUs", SUM('Metrics By Item And Day'[CU (s)]))
INFO.VIEW.TABLES(), INFO.VIEW.COLUMNS(), INFO.VIEW.MEASURES() work over executeQueries; INFO.TABLES() and measure expressions do not/; use IDs with fab api
fab get ".capacities/<name>.Capacity" -q properties.state # Active | Paused, ~10 s
fab start ".capacities/<name>.Capacity" -f
fab stop ".capacities/<name>.Capacity" -f # bills the carry forward at once
fab get output ends in \r; strip it before comparing.
Failure modes seen on one tenant, in the order they surfaced:
AADSTS700082); scheduled refresh stops and the model goes stale silently. Re-enter the credential in the model settings, then refresh/
The credentials provided for the CapacityMetricsCES source are invalid, QueryUserError) even with a passing connection test and working refreshes. Only deleting the app workspace and installing the app fresh fixed it: Get it now, Connect, UTC_offset in standard time, OAuth2, pick the capacity admin in the account window. A fresh install gets new workspace and model IDsThe credentials provided for the CapacityMetricsCES source are invalid (QueryUserError). Save again with the box unticked; open the settings page with ?alwaysPromptForContentProviderCreds=true to force a fresh OAuth prompt and pick the capacity admin account explicitly when the browser holds severalfabric-cli capacity-cost.md
__fabric_plan_sys and <name>_plan databases Planning creates, and app backends' databases) consume CU continuously while awake