Onelake Catalog CLI
MicrosoftOfficialPublished by Microsoft
- Skill
- Workflow
- Automation and integrations
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The onelake-catalog-cli skill provides a structured interface for managing the Microsoft Fabric OneLake catalog. It operates through distinct modes for governance auditing and metadata curation, ensuring that actions are performed with appropriate permissions and safety gates. The skill supports tenant-wide admin audits, data-owner governance checks, and item-level metadata curation, including descriptions, tags, and table/column metadata. It enforces strict write-gating and requires explicit owner approval for all changes to ensure data integrity and security.
What it does
- Audits tenant-wide or workspace-specific governance posture.
- Curates item metadata including descriptions, display names, and tags.
- Manages table and column descriptions for items with OneLake Tables.
- Performs guarded remediation for domains, workspace assignments, and capacities.
- Provides dry-run capabilities for governance and remediation tasks.
- Enforces strict write-gates requiring explicit user approval for all changes.
When to use it
- When you need to audit governance posture across a Fabric tenant or specific workspaces.
- When an item owner needs to improve discoverability through metadata curation.
- When a data owner needs to remediate workspace domain, capacity, or tag assignments.
- When a tenant admin needs to perform bulk governance updates or policy enforcement.
Advantages
- Provides a unified, mode-based workflow for both auditing and remediation.
- Enforces safety by requiring explicit approval for all write operations.
- Supports granular, least-privileged access for data owners.
- Includes built-in logic for handling long-running operations and API rate limits.
- Ensures governance findings are actionable and prioritized.
Usage examples
- “Propose a better description for the semantic model Sales Model in the Finance workspace.”
- The agent will read the current item metadata, draft a suggested description based on content, and present it for owner approval before applying the change.
- “Audit our tenant's OneLake catalog governance posture and prioritize the findings.”
- The agent will perform a tenant-wide audit, applying the necessary scope filters, and report findings categorized by pillar with recommended actions.
- “Which workspaces I administer are not assigned to a domain?”
- The agent will identify and list all workspaces within the caller's scope that lack a domain assignment.
- “Show a dry run for assigning these workspaces to the Finance domain, including current assignments.”
- The agent will perform a read-only check to display the current domain assignments and the proposed changes for the specified workspaces.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/microsoft/onelake-catalog-cli/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip onelake-catalog-cli.zip -d .agents/skills
Documentation by Microsoft
Telemetry — MANDATORY. Every
api.fabric.microsoft.comcall must carryx-ms-fabric-skill: onelake-catalog-cli(az rest:--headers "x-ms-fabric-skill=onelake-catalog-cli"), including every LRO poll,fabric_lroand retry. Snippets omit it — add it anyway.
CRITICAL NOTES
To find the workspace ID from its name, one call:
az rest --method get --resource "https://api.fabric.microsoft.com" --url "https://api.fabric.microsoft.com/v1/workspaces" --query "value[?displayName=='<name>'] | [0].id" -o tsv(followcontinuationTokenonly if it isn't on the first page; details in COMMON-CLI.md § Finding Workspaces and Items in Fabric).To find an item's ID, one call: the same on
.../v1/workspaces/{ws}/items?type=<Type>with--query "value[?displayName=='<name>'] | [0].id".Write-gated skill — never call a write API before its gate below has passed. For curation that means the owner reviewed every proposed change and explicitly confirmed — not even a "test" write to check whether a change is allowed or what is already applied.
The item list and Get Item both return an item's
tags. An item with no tags has notagsfield — that absence means untagged.
OneLake Catalog — CLI Skill (mode dispatcher)
One skill for the OneLake catalog. Govern (catalog health, protection and trust: audits and guarded remediation, by permission tier) and curate (an owner improving specific items' discoverability metadata) are modes, each detailed in a reference loaded on demand. This file picks the mode, holds every write gate, and indexes the references.
Mode selection
| Mode | Use when | Load | Writes |
|---|---|---|---|
| curate | An owner wants specific items easier to find: a description, a clearer display name, tags, or table and column descriptions (items with a OneLake Tables folder) — one item, an explicit list, or one named workspace's weakly-described items | references/curate.md | ✅ after the owner approves each suggestion |
| dataowner-audit | A non-admin workspace or domain owner wants governance posture for workspaces they administer (widen to accessible on request; Core API) | references/dataowner-audit.md | ❌ |
| dataowner-remediate | A data owner who is also a domain / workspace / capacity admin fixes a governance finding — single-workspace domain or capacity assignment, workspace tags, refresh, item identity (Core & Power BI APIs, no tenant admin), including dry runs of these | references/dataowner-remediate.md | ✅ self-service |
| admin-audit | A Fabric tenant admin wants tenant-wide governance posture (/v1/admin/*) | references/admin-audit.md; any tenant count starts from admin-audit-scope.md | ❌ |
| admin-remediate | A Fabric tenant admin makes tenant-wide writes — domains, bulk assignment, domain roles, bulk labels, tenant tag definitions, tenant settings | references/admin-remediate.md | ✅ |
Govern is a 2×2 grid — tier (which API surface the caller can reach) × action (audit vs
remediate) — covering the health, protect and trust pillars. Choose the tier by API surface,
not job title: the admin-* modes need the Fabric tenant administrator role (Fabric admin /
Power Platform admin / M365 global admin); domain, capacity and workspace admins who are not
tenant admins live entirely in the dataowner-* modes.
Mode boundary rules
A direct curation request goes straight to curate. Read the target item's current state — don't run a governance audit first. Curation needs neither tenant admin nor workspace Admin; each change has its own permission (see curate.md).
Governance starts with an audit. Never remediate before establishing the current state; audit → remediate within the same tier unless the caller's rights change.
Curate is the only writer of item metadata. Item descriptions and display names, applying or removing an item's tags, and table and column descriptions are written only in curate. Workspace tags stay in dataowner-remediate; tenant tag definitions in admin-remediate.
Govern finds, curate fixes. Govern reports description and tag coverage — presence, with scope, denominator and freshness caveats, not proof the text is accurate; curate judges content and proposes. To fix selected gaps, hand off to curate with: a bounded target (an explicit item list with workspace ID, item ID and type, or one named workspace — never the whole tenant: ask the user to pick), the observed gap with its source and time (a candidate to recheck, not current truth), only the fields the user chose ("fix missing descriptions" = description only), and known access limits and owner contacts. A remediation is done only when curate has verified the write.
Audit modes never write. If a write is asked for in an audit mode, switch explicitly to the matching remediate mode or to curate — don't improvise a write.
A dry run or preflight of a fix loads that fix's remediate mode and stays read-only there — it isn't an audit. Moving one workspace to a domain is
dataowner-remediate; bulk assignment isadmin-remediate.Finding items when the workspace isn't known belongs to
search-consumption-cli. Looking up a workspace or domain by name, or an item by name inside a known workspace, is not discovery: use the lookups in CRITICAL NOTES and don't loadsearch-consumption-clifor it.
⚠️ Known Fabric gap. A domain or workspace admin who is not a tenant admin has no API for their scoped governance posture:
/v1/admin/*rejects them and the Core API can't list a domain's workspaces.dataowner-auditcovers only workspaces the caller can access — say so up front rather than routing into anadmin-*mode that will 401/403.
Terminal write — the step you must not skip
Reading a reference, drafting suggestions or building a dry run is NOT completing a write. Each writing mode ends with the state-changing call(s) below, issued only after the gate for that write passes. If you did not issue it, nothing changed — say so rather than reporting success.
| Mode | Terminal write |
|---|---|
curate | PATCH /v1/workspaces/{ws}/items/{id} (description; display name in a separate call), POST .../items/{id}/applyTags or unapplyTags, and for a table POST https://onelake.table.fabric.microsoft.com/common/v1/{ws}/{item}/schemas/{schema}/tables/{table}/additionalMetadata with the complete set from a fresh read — only for suggestions the owner accepted |
dataowner-remediate | POST /v1/workspaces/{id}/assignToDomain / unassignFromDomain (synchronous 200), assignToCapacity (202 — poll to a terminal state), POST /v1/workspaces/{id}/applyTags / unapplyTags (workspace tags), item identity, semantic model refresh |
admin-remediate | /v1/admin/* writes — domains, bulk workspace assignment, domain roles, labels, tenant tag definitions, tenant settings |
dataowner-audit, admin-audit | none — read-only |
Before reporting a write done, confirm an explicit success (200/201, or a terminal LRO
success for a 202) and read the result back.
Write gates — must pass first
| Write | Mode | Gate |
|---|---|---|
| Any curation write | curate | The owner saw a numbered current → proposed preview of every suggestion and explicitly approved; "apply all" covers only what was shown. Approving an audit or picking a remediation never approves text the owner hasn't seen. |
| Table and column descriptions | curate | A write replaces the table's whole additional metadata: re-read, change only the approved descriptions, send the complete set in the same command, read again. The API has no concurrency check — never claim concurrent edits were preserved. A shortcut table is written on its source — name it and get explicit confirmation. |
| Delete a domain | admin | Check subdomains (parentDomainId) and assigned-workspace counts for the domain and every subdomain; if workspaces would be orphaned, STOP and get explicit confirmation naming them. The API has no cascade-block. See domain-crud.md. |
| Delete a tag definition | admin | Report how many items carry it first — deletion detaches it everywhere with no undo. |
| Bulk-assign workspaces to a domain | admin | Check each target's current domainId and warn before silently overriding an assignment. Dry-run the target list first. |
| Remove a principal from a domain role | admin | Confirm it will not leave the domain ownerless; name the principal being removed. |
| Bulk sensitivity-label change | admin | Dry-run: show the affected items and before/after label, get confirmation. No service principal / managed identity — the call will fail. |
| Write a tenant setting | admin | Read and show the current value, then the proposed value — tenant-wide blast radius. |
| Assign / unassign one workspace to a domain | dataowner | A move is a reassignment — confirm the current domainId and name the domain it leaves. Needs domain contributor and workspace Admin; say which is missing on failure. |
| Reassign item ownership (item identity, preview) | dataowner | Assigns to the caller only; needs Write on the item and its children. Confirm the intended identity. |
| Assign a workspace to a capacity | dataowner | Needs workspace Admin plus capacity Contributor/Admin. 202 is not success — poll to a terminal state. |
| Apply / remove a workspace tag (preview) | dataowner | Needs workspace Admin. Name the workspace and the tags, and confirm. Removing an applied tag is not deleting its definition. |
Don't promise a write that has no API. Endorsement, DLP policies, an owner changing a sensitivity label, and tenant-admin item deletion have no write route — say so and name who can act (no-write-api-escalation.md). A SQL Database's display name is fixed at creation: never send a rename for it, even when the owner asks for one — say it can't be renamed and offer the description and tags instead.
Shared essentials (all modes)
Prerequisites: auth & tokens · REST, pagination, LRO, rate limits · CLI auth recipes ·
az rest(always pass--resource) · OneLake viacurl(Storage-audience token) · OneLake shortcuts.Resolve workspace and item IDs with the one-call lookups in CRITICAL NOTES 1–2.
Keep tool calls few. Each call re-sends the whole conversation, so extra calls are slow and costly. Combine related reads in one script, and don't re-open a doc you've already read.
Read an item's definition in one command that waits for the long-running operation itself (a semantic model usually returns
202) — never poll it in separate calls. It waits as long as Fabric'sRetry-Afterasks (often 20–30 s), so give the command up to 3 minutes: if your shell tool has a wait or timeout setting, raise it rather than letting the command move to the background. Only for types with a definition: Warehouse, SQL Database, SQL analytics endpoint, ML model/experiment and Datamart have none — read their schema instead. PowerShell 7 (bash:fabric_lroin COMMON-CLI.md):$h = @{ Authorization = "Bearer $(az account get-access-token --resource https://api.fabric.microsoft.com --query accessToken -o tsv)"; 'x-ms-fabric-skill' = 'onelake-catalog-cli' } $st = @{ n = 0; end = (Get-Date).AddMinutes(3) } # Waits the full Retry-After (202 and 429); backs off 2-30 s only when the header is missing or invalid. function Wait-RetryAfter($r) { $ra = 0 if (-not [int]::TryParse("$(@($r.Headers['Retry-After'])[0])", [ref]$ra) -or $ra -lt 1) { $ra = [Math]::Min(30, [Math]::Pow(2, ++$st.n)) } if ((Get-Date).AddSeconds($ra) -gt $st.end) { throw "Definition read did not finish within 3 minutes." } Start-Sleep -Seconds $ra } while (($r = Invoke-WebRequest -Method Post -Uri "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/items/$ITEM_ID/getDefinition" -Headers $h -SkipHttpErrorCheck).StatusCode -eq 429) { Wait-RetryAfter $r } if ($r.StatusCode -ge 400) { throw "getDefinition returned $($r.StatusCode): $($r.Content)" } $def = if ($r.StatusCode -eq 202) { $op = [string]$r.Headers['Location']; $res = $r; $s = '' while ($s -notin 'Succeeded', 'Failed') { Wait-RetryAfter $res; $res = Invoke-WebRequest $op -Headers $h -SkipHttpErrorCheck if ($res.StatusCode -eq 200) { $s = ($res.Content | ConvertFrom-Json).status } elseif ($res.StatusCode -ne 429) { throw "Polling returned $($res.StatusCode): $($res.Content)" } } if ($s -ne 'Succeeded') { throw "Definition read failed: $($res.Content)" } while (($res = Invoke-WebRequest "$op/result" -Headers $h -SkipHttpErrorCheck).StatusCode -eq 429) { Wait-RetryAfter $res } if ($res.StatusCode -ge 400) { throw "Definition result returned $($res.StatusCode): $($res.Content)" } $res.Content | ConvertFrom-Json } else { $r.Content | ConvertFrom-Json } $dir = New-Item -ItemType Directory -Force -Path (Join-Path ([IO.Path]::GetTempPath()) "def-$ITEM_ID") foreach ($p in $def.definition.parts) { $t = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($p.payload)); $f = Join-Path $dir ($p.path -replace '[\\/:]', '_'); Set-Content -LiteralPath $f -Value $t "== $($p.path) ($($t.Length) chars)"; if ($t.Length -le 4000) { $t } else { $t.Substring(0, 4000); "[first 4000 of $($t.Length) chars; full text in $f]" } }A part cut at 4,000 characters is saved in full: read the rest (one call) if what's shown isn't enough.
Use the exact Fabric Admin, Core, Power BI, Graph or OneLake API surface the mode documents; a
401or403is never permission to bypass RBAC.
Rules
MUST
Load exactly one mode reference for the request and follow it end to end; come back to the index below when another procedure is needed. In curate, also read the suggestion guidance before drafting anything, and the table metadata reference before any table or column work.
(curate) Propose exactly what the owner asked for. A specific request gets only that: "add a description" → the item description; "suggest tags" → tags; "describe the table" → the table description only; "describe the columns" → column descriptions only; "describe the item's objects" or "its tables and columns" → both. A general request ("curate this item", "make it more discoverable", "improve its metadata") gets the item's description, name and tags; an item with a OneLake Tables folder also gets its table and column descriptions. If the owner names several items, cover each one, and report each with only the fields it has.
(curate) Check the scope before any call. Curate covers one item, an explicit list of items, or one named workspace at a time. For a tenant-wide request ("all my items", "every workspace"), say plainly that it isn't supported and offer one named workspace or an explicit list; for several named workspaces, ask which to start with. Don't list workspaces or items first.
(govern) State scope, exclusions, pagination completeness, and freshness caveats with every governance statistic.
PREFER
Least-privileged Core or Power BI APIs for data-owner actions instead of requiring tenant-admin rights.
Findings as evidence, consequence, recommended action, priority and effort — not an inventory dump.
Sequencing ownership and access-scope fixes before bulk assignment or labeling.
AVOID
Mutating a tenant from an audit mode, or reporting an asynchronous
202as completion.Inventing write APIs for endorsement, DLP policy, admin item deletion, or third-party item-identity assignment.
(curate) Volunteering anything about table or column descriptions for items without a OneLake Tables folder (semantic models, reports, notebooks, pipelines, dataflows, …). For these items, description, name and tags are the complete list — present them without qualifiers in the preview and whenever you say what the skill can do (e.g. while declining a request, or offering what else you could review next). Don't add a note that table or column descriptions are N/A, don't apply or aren't covered, and don't offer them: the owner didn't ask. Only if they ask, answer that they aren't supported for that item type, then stop and let the owner choose — don't load another skill or draft those descriptions yourself.
(curate) Saying "sub-items" — use the owner's words: "tables" and "columns", or "objects" when speaking generally.
References
Each reference is one hop from this index; after loading one, return here when another is needed.
Curate
Curate — workflow, permission per change, preview format, examples, errors
Suggestion guidance — drafting descriptions, names and tags from content
Tag taxonomy — tenant/domain tag scope and name → ID resolution
Table metadata — table and column descriptions (OneLake table API, preview)
Curation API reference — Update Item, Apply/Unapply Tags, List Tags
Govern — shared
Govern pillars — the three pillars, what "good" looks like, reporting conventions
Governance data sources — verified API field coverage and blind spots
Governance roles — permission tiers, domain/workspace roles, insight refresh lag
Catalog concepts — the entity model and API-backed versus conceptual terms
Govern — modes
Admin audit — tenant-wide read-only governance assessment
Admin audit scope — governable denominator (active workspaces of type Workspace), exclusions, and known blind spots
Admin audit assessment — end-to-end evaluative workflow, prioritization, and deliverable contract
Admin remediate — tenant-wide guarded writes through Admin APIs
Data-owner audit — caller-scoped read-only checks through Core APIs, including a workspace's domain assignment
Data-owner workspace health — empty and inactive workspaces within the caller's scope
Data-owner remediate — least-privileged Core and Power BI writes: moving one workspace to a domain, capacity, workspace tags, refresh, item identity
Govern — admin audit procedures: domain health · workspace health · capacity health · item inventory · item health · protect coverage · trust curation
Govern — admin remediation procedures: domain lifecycle · bulk workspace assignment (tenant admin) · domain roles · tag definitions · item sensitivity labels · domain default labels · trust remediation · no-write escalation
Examples
I'm curating my items for the OneLake catalog. Propose a better description for the semantic model Sales Model in the Finance workspace.Make the lakehouse LSEGDemo more discoverable — describe its tables and columns too.Audit our tenant's OneLake catalog governance posture and prioritize the findings.Which workspaces I administer are not assigned to a domain?Show a dry run for assigning these workspaces to the Finance domain, including current assignments.Find unlabeled items tenant-wide and explain which remediations require a tenant admin versus a data owner.Files
- ATTRIBUTION.mdAdded by AutoGineer883 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md21.5 KiB
- apm.yml345 B
- references/admin-audit-assessment.md10.9 KiB
- references/admin-audit-scope.md5.7 KiB
- references/admin-audit.md14.9 KiB
- references/admin-audit/health-capacity.md7.3 KiB
- references/admin-audit/health-domains.md11.5 KiB
- references/admin-audit/health-item.md13.7 KiB
- references/admin-audit/health-workspaces.md15.4 KiB
- references/admin-audit/item-inventory.md9.1 KiB
- references/admin-audit/protect-labels-dlp.md1.4 KiB
- references/admin-audit/trust-curation.md2.8 KiB
- references/admin-remediate.md17.1 KiB
- references/admin-remediate/domain-assign-workspaces.md7.3 KiB
- references/admin-remediate/domain-crud.md10.5 KiB
- references/admin-remediate/domain-default-label.md2.6 KiB
- references/admin-remediate/domain-roles.md4.5 KiB
- references/admin-remediate/item-sensitivity-label.md2.6 KiB
- references/admin-remediate/no-write-api-escalation.md13.4 KiB
- references/admin-remediate/tags.md1.9 KiB
- references/admin-remediate/trust-curate.md3.4 KiB
- references/catalog-concepts.md7.2 KiB
- references/curate.md19.7 KiB
- references/curate/api-reference.md7.8 KiB
- references/curate/metadata-suggestion-guidance.md10.6 KiB
- references/curate/table-metadata.md9.9 KiB
- references/curate/tag-taxonomy.md3.1 KiB
- references/dataowner-audit.md14.4 KiB
- references/dataowner-audit/health-workspaces.md14.1 KiB
- references/dataowner-remediate.md15.0 KiB
- references/govern-data-sources.md7.9 KiB
- references/govern-pillars.md13.3 KiB
- references/govern-roles.md9.9 KiB
references/dataowner-audit/health-workspaces.md
<!-- MODE REFERENCE for onelake-catalog-cli (mode: dataowner-audit). Loaded on demand by the dataowner-audit reference. -->
Workspace Health (Data Owner scope) — My Workspaces: Empty and Inactive
Contents
The two questions this mode answers
List My Workspaces (the scope for everything below)
Find Empty Workspaces (zero items) — within my scope
Find Inactive Workspaces (no job run in the last 28 days) — within my scope
What This Mode Cannot Do (say so — don't substitute a weaker answer)
Gotchas — Workspace Health (Data Owner)
Read this when: A non-admin data owner wants to check the health of the workspaces they administer — how many are empty, and how many have gone quiet — without tenant admin rights.
Part of the onelake-catalog-cli skill (dataowner-audit mode). Return to dataowner-audit.md for the mode's scope limits, auth and the rest of the workflow. For the tenant-wide version of these checks — every workspace, audit-log-grade activity, bulk role scans, and orphaned / single-admin (bus-factor) analysis — see the admin counterpart admin-audit/health-workspaces.md; it needs a Fabric tenant admin role.
⚠️ Scope — the workspaces you administer, not the tenant
For a data-owner (non-admin) identity the default scope is the workspaces where the caller holds the Admin role — the ones they are accountable for and can actually act on — not the whole tenant, and not every workspace they can merely open. Enumerate them with the Core control-plane API:
GET /v1/workspaces?roles=AdminWiden to
roles=Admin,Member,Contributoronly when the user explicitly asks about workspaces they merely participate in — and say which cut you used.This is the opposite default from
admin-auditmode. Do not reach for/v1/admin/*here — those endpoints need a Fabric tenant admin role and return403to a data owner. The Core list returns only what the caller can see, which is typically a subset of the tenant.Be transparent that this is a personal, self-scoped view. Lead the answer with the scope, e.g. "Across the N workspaces you administer…" — never present a data-owner count as a tenant total. If the user wants the tenant picture ("how many workspaces exist?", "which domains are empty?"), tell them plainly it requires tenant admin rights +
admin-auditmode; the Core API cannot answer it.
Reporting template. Report each finding as finding → evidence → why it matters → recommended action → priority → effort, and state clean/pass results explicitly ("checked, no gap"). Always name the scope the numbers cover ("of the N workspaces you administer") and the activity window you used. Canonical definition: the shared Deliverable Contract.
The two questions this mode answers
| Finding | Means | Source | Cost |
|---|---|---|---|
| Empty | Contains zero items | GET /v1/workspaces/{id}/items | 1 call per workspace |
| Inactive (28 days) | No job run in the window — a much narrower signal than the admin one | GET /v1/workspaces/{id}/items/{itemId}/jobs/instances | 1 call per item |
They are two different findings with two different blind spots. Report them as separate lines and never merge them into a single "unused" number.
List My Workspaces (the scope for everything below)
Scope to the workspaces you administer. Paginate with continuationToken (a query parameter — Core-style, not the admin continuationUri):
url="https://api.fabric.microsoft.com/v1/workspaces?roles=Admin"
all_ws="[]"
while [ -n "$url" ] && [ "$url" != "null" ]; do
resp=$(az rest --method GET --url "$url" --resource "https://api.fabric.microsoft.com")
all_ws=$(jq -s '.[0] + .[1].value' <(echo "$all_ws") <(echo "$resp"))
token=$(echo "$resp" | jq -r '.continuationToken // empty')
if [ -n "$token" ]; then
url="https://api.fabric.microsoft.com/v1/workspaces?roles=Admin&continuationToken=${token}"
else
url=""
fi
done
echo "$all_ws" > /tmp/my_workspaces.jsonroles=Admin is the default because you cannot remediate anything you are not the Admin of. The Core Workspace object exposes displayName (not name — that's the Admin object), so filter/report on displayName.
Find Empty Workspaces (zero items) — within my scope
You can do this without admin rights: for each workspace you administer, list its items via the Core API and flag the ones with none. Live-verified: GET /v1/workspaces/{id}/items succeeds for a workspace the caller has a role on.
for id in $(jq -r '.[].id' /tmp/my_workspaces.json); do
n=$(az rest --method GET \
--url "https://api.fabric.microsoft.com/v1/workspaces/${id}/items" \
--resource "https://api.fabric.microsoft.com" \
--query "length(value)" --output tsv 2>/dev/null)
echo "${id} ${n:-ERR}"
done | awk -F'\t' '$2==0 {print $1}'Empty is an inventory fact, not a usage verdict. A workspace with zero items may be brand-new, or actively churned — items created and deleted between scans. Report emptiness plainly and do not recommend deletion from an item count alone. The activity check below narrows the picture a little, but it only sees job runs, so it cannot prove disuse either.
Find Inactive Workspaces (no job run in the last 28 days) — within my scope
You can measure activity without admin rights — but only one kind of it. GET /v1/workspaces/{id}/items/{itemId}/jobs/instances is a Core endpoint available to a workspace member, returning each run with startTimeUtc, endTimeUtc, status and failureReason. A workspace counts as inactive when no item in it has a job run newer than the cutoff.
$token = az account get-access-token --resource https://api.fabric.microsoft.com --query accessToken -o tsv
$headers = @{ Authorization = "Bearer $token" }
$cutoff = (Get-Date).ToUniversalTime().AddDays(-28)
function Get-AllValues([string]$Uri) {
$values = @()
$baseUri = $Uri
$separator = if ($baseUri.Contains('?')) { '&' } else { '?' }
do {
$page = Invoke-RestMethod -Uri $Uri -Headers $headers
$values += @($page.value)
$continuationToken = [string]$page.continuationToken
$Uri = if ([string]::IsNullOrWhiteSpace($continuationToken)) {
$null
} else {
"${baseUri}${separator}continuationToken=$([uri]::EscapeDataString($continuationToken))"
}
} while ($null -ne $Uri)
$values
}
$workspaces = Get-Content /tmp/my_workspaces.json | ConvertFrom-Json
$workspaceLastJob = foreach ($workspace in $workspaces) {
$items = @(Get-AllValues "https://api.fabric.microsoft.com/v1/workspaces/$($workspace.id)/items")
$unassessableItems = 0
$latest = foreach ($item in $items) {
try {
$jobs = @(Get-AllValues "https://api.fabric.microsoft.com/v1/workspaces/$($workspace.id)/items/$($item.id)/jobs/instances")
if ($jobs.Count -eq 0) {
$unassessableItems++
continue
}
$jobs | ForEach-Object { [datetime]$_.startTimeUtc }
} catch {
$unassessableItems++
continue
}
}
[pscustomobject]@{
WorkspaceId = $workspace.id
ItemCount = $items.Count
UnassessableItems = $unassessableItems
LastJobUtc = @($latest | Sort-Object -Descending)[0]
}
}
# Inactive candidates have items, at least one assessable item, and no recent run.
$workspaceLastJob | Where-Object {
$_.ItemCount -gt 0 -and
$_.UnassessableItems -lt $_.ItemCount -and
(-not $_.LastJobUtc -or $_.LastJobUtc -lt $cutoff)
}
# Report these separately as unassessed, never inactive.
$workspaceLastJob | Where-Object {
$_.ItemCount -gt 0 -and $_.UnassessableItems -eq $_.ItemCount
}Both the item list and every job-instance list are paginated. Exhaust every
continuationToken before calculating the newest run; otherwise a later page can
contain the evidence that a workspace is active.
⚠️ Say what "inactive" actually measured — this signal is far narrower than the admin one
jobs/instancesrecords job runs: notebook runs, pipeline runs, dataflow refreshes, and scheduled or on-demand semantic model refreshes. It does not record:
report and dashboard views
SQL analytics endpoint / Warehouse queries
Lakehouse browsing and direct OneLake reads and writes
item edits made in the portal
A workspace of Power BI reports opened by 500 people every morning has zero job runs, and this check will call it inactive. The admin-only Activity Events API sees all of the above; this one does not.
Never report the number without the definition. Say "N of the M workspaces you administer had no job run in the last 28 days" — not "N workspaces are unused". If the user needs a real usage verdict, say plainly that it requires tenant admin rights and
admin-auditmode.
The 28-day window is a choice — print it
28 days matches the retention ceiling of the admin Activity Events API (live-verified there:
-27days succeeded,-28was rejected), so a data-owner answer stays comparable to the admin one and never implies more history than the tenant can confirm. Job history is not bound by that same limit, so a longer look-back may return data — but if you use one, state the window, and never quietly shorten it because the scan was slow.
Two failure modes to handle rather than hide:
| What you'll hit | Why | What to do |
|---|---|---|
Empty value list, or a non-200, on jobs/instances | Not every item type has a job concept — reports, dashboards, unscheduled semantic models, lakehouses with no scheduled work | Treat both as no signal, not as inactive. Say how many workspaces rested entirely on unassessable items |
| An empty workspace comes back inactive | Zero items means zero job history, so it is trivially inactive — and the fact adds nothing | Exclude empty workspaces from the inactive count. Otherwise one workspace is reported twice as two different problems |
Cost: one call per item plus one per workspace. Fine for tens of workspaces, slow for hundreds — if you cap or sample, say so instead of presenting a partial scan as a complete one.
Reporting the two together
Empty — an inventory fact. Give the count and the names.
Has items + no job run in 28 days — a candidate for review, nothing more.
Empty + no domain assigned — the strongest cleanup candidate a data owner can identify alone (see Find My Unassigned Workspaces).
Deletion is never an automatic recommendation, and in this mode you cannot see the usage evidence that would justify one. Surface candidates for a human decision.
What This Mode Cannot Do (say so — don't substitute a weaker answer)
| Question | Why it's out of reach without admin | Where it lives |
|---|---|---|
| "How many workspaces are in the tenant?" | Core /v1/workspaces is user-scoped; you see only a subset. | admin-audit — GET /v1/admin/workspaces?type=Workspace&state=Active |
| "Which workspaces are unused in the audit-log sense — views, queries, edits?" | The Activity Events API (/v1.0/myorg/admin/activityevents) is a Power BI admin endpoint — 403 for a data owner. All you can measure here is job runs. | admin-audit/health-workspaces.md |
| "Which of my workspaces are orphaned / single-admin (bus factor)?" | Out of scope for this mode by design — not a permission wall. Bus factor is a portfolio question about the whole estate; a self-scoped answer covers only your corner while reading as though it covered more. Route it to an admin, who can see the full distribution and the escalation paths. | admin-audit/health-workspaces.md |
| "Which domains are empty?" | No Core API lists a domain's workspaces. | admin-audit/health-domains.md |
Gotchas — Workspace Health (Data Owner)
| Symptom | Cause / verified reality | Fix |
|---|---|---|
| Count looks smaller than the portal / than a colleague's | Core /v1/workspaces is user-scoped, and roles=Admin narrows it further to the ones you administer. | Expected. State the scope and the roles cut; for the tenant total, use admin-audit mode. |
| Answer doesn't say whose workspaces it covers | Scope left implicit; a reader may assume tenant-wide. | Lead with "of the N workspaces you administer". |
| Reported "N workspaces are unused" | The Core signal is job runs only — blind to report views, SQL queries, OneLake reads and portal edits. | Report it as "no job run in the last 28 days" and name the window. |
| An empty workspace also shows up in the inactive list | Zero items means zero job history — trivially inactive, and meaningless. | Exclude empty workspaces from the inactive count; report the two findings separately. |
jobs/instances returns nothing for an item | That item type has no job concept (reports, dashboards, unscheduled models). | No signal, not inactive. State how much of the workspace was unassessable. |
| Activity scan runs for a very long time | One call per item, not per workspace. | Cap or sample if you must — and say the scan was partial rather than presenting it as complete. |
| Asked about orphaned / single-admin workspaces | Bus factor is an admin portfolio question; this mode deliberately doesn't answer it. | Say so and route to admin-audit — don't produce a self-scoped answer that looks tenant-wide. |
403 on any /v1/admin/* call | You lack the tenant admin role. | Don't retry or work around it; switch to admin-audit mode only if the identity actually has admin rights. |
| Pagination stops early | Used admin-style continuationUri instead of the Core continuationToken query parameter. | Core APIs page via ?continuationToken=.... |
| Recommending deletion because a workspace has 0 items | Empty ≠ unused, and the job-run signal can't prove disuse either. | Report emptiness as inventory only; leave deletion to a human decision. |
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills-for-fabric · skills/onelake-catalog-cli · commit f8fac11
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- microsoft/skills-for-fabric
AutoGineer is not affiliated with or endorsed by Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download onelake-catalog-cli.zip