Fabric CLI
Guidance for using fab to programmatically manage Fabric & Power BI service
- Install via
uv tool install ms-fabric-cli (get uv via winget install uv or brew install uv)
- Fabric CLI is for working with the Cloud environment and not local files; it works with Power BI Pro, PPU, or Fabric; you DO NOT need a Fabric SKU to use the Fabric CLI
- Target version: ≥ 1.6.1. Older versions lack
fab find, the interactive REPL, --format on export, fab deploy, and several item types. Run fab --version to confirm. Key version deltas in Fab CLI version history below.
[!IMPORTANT]
Any time you encounter errors, user preferences or learnings when using the Fabric cli, ALWAYS note these down in the user memory rules, i.e. .claude/rules/fabric-cli.md for future improvement.
This is ONLY for generic learnings and not for item- or task-specific learnings.
When to use this skill
- Use whenever the user mentions "Fabric" or "Power BI"
- Use when user asks about Power BI workspaces, deployment, tenants, publishing, download, permissions, or data
Critical general rules
- IMPORTANT: The first time you use
fab run check that it is up to date to the latest version and run fab auth status; If user isn't authenticated, ask them to run fab auth login
- Always use
fab --help and fab <command> --help the first time you use a command to understand its syntax
- You must search the skill /references/ for relevant reference files that explain certain commands, examples, scripts, or workflows before you start using
fab
- Before first use, ask the user if they have Fabric admin access, sensitivity labels or DLP policies, any API restrictions, or preferences for Fabric/Power BI API usage; remind user to add this to memory files
- If workspace or item name is unclear, ask the user first, then verify with
fab ls or fab exists before proceeding
- Ensure that you avoid removing or moving items, workspaces, or definitions, or changing properties without explicit user direction
- If a command is blocked in your permissions and you try to use it, stop and ask the user for clarification; never try to circumvent it
- Create output directories before export:
fab export does not create intermediate directories; mkdir -p the output path first or the command fails with [InvalidPath]
Use -f (force) for non-interactive use
The fab CLI prompts for confirmation, so you you must always append -f to prevent this UNLESS sensitivity labels are enabled, in which case you must ask the user. Do this for the commands:
fab get -q "definition" ; sensitivity label confirmation
fab export ; sensitivity label confirmation
fab import ; overwrite confirmation
fab cp / fab cp -r ; overwrite and sensitivity label confirmation
fab rm ; delete confirmation
fab assign / fab unassign ; capacity/domain assignment confirmation
fab mv ; rename/move confirmation
Quickstart guide
You must read and understand the common list of operations with simple examples
- Check the commands, syntax, and auth status:
fab --help and fab auth status
- Check if the item exists if the user gave the workspace and item name:
fab exists "spaceparts-dev.Workspace/spaceparts-otc-full.SemanticModel"
- Find an item by name across all accessible workspaces:
fab find 'sales' -P type=Report -l (requires fab ≥ 1.6.1; substring on name/description/workspace; -P type=X to filter by type; -l for IDs; -q '<jmespath>' for client-side projection)
- For governance fields not returned by
fab find (last visit, last refresh, owner, storage mode, capacity SKU): use scripts/search_across_workspaces.py instead
- Find the workspace:
fab ls
- Find the item:
fab ls "Workspace Name.Workspace"
- Check the commands for that item:
fab desc to get itemTypes
fab desc .<ItemType> for commands i.e. fab desc .SemanticModel
- What's in that item; what's it for; what is it?:
- Full TMDL definition:
fab get "spaceparts-dev.Workspace/spaceparts-otc-full.SemanticModel" -q "definition" -f
- Search a specific measure / table / column:
fab get "ws.Workspace/Model.SemanticModel" -q "definition" -f | rga -i "Sales Amount"
- Get files, tables, or table schemas:
- List lakehouse files:
fab ls "ws.Workspace/LH.Lakehouse/Files"
- List lakehouse tables:
fab ls "ws.Workspace/LH.Lakehouse/Tables"
- Table schema:
fab table schema "ws.Workspace/LH.Lakehouse/Tables/gold/orders"
- Query data (always prefer the wrapper scripts over raw
fab api / duckdb / sqlcmd; they resolve IDs, hosts, and auth for you):
- Semantic model (DAX):
python3 scripts/execute_dax.py "ws.Workspace/Model.SemanticModel" -q "EVALUATE TOPN(10, 'Orders')"
- Lakehouse or warehouse (DuckDB + Delta against OneLake):
python3 scripts/query_lakehouse_duckdb.py "ws.Workspace/LH.Lakehouse" -q "SELECT * FROM tbl LIMIT 10" -t gold.orders
- Lakehouse SQL endpoint, warehouse, or SQL database (T-SQL via
sqlcmd + az session): python3 scripts/query_sql_endpoint.py "ws.Workspace/LH.Lakehouse" -q "SELECT TOP 10 * FROM dbo.orders"
- Set properties for an item or workspace:
fab set "ws.Workspace/Item.Notebook" -q displayName -i "New Name" or fab set "ws.Workspace" -q description -i "Production environment"
- Review or manage permissions:
- Item ACL:
fab acl ls "ws.Workspace/Model.SemanticModel" then fab acl set "ws.Workspace/Model.SemanticModel" -I user@contoso.com -R Read
- Workspace roles:
fab acl ls "ws.Workspace" then fab acl set "ws.Workspace" -I user@contoso.com -R Member
- Deploy items to Fabric:
- Single item:
fab import "ws.Workspace/New.Notebook" -i ./local-path/Nb.Notebook -f
- Multi-item CI/CD pipeline (dev→test→prod):
fab deploy (requires fab ≥ 1.5.0, integrates with fabric-cicd; replaces hand-rolled deploy scripts)
- Download items from Fabric:
fab export "ws.Workspace/Nb.Notebook" -o ./backup -f (always mkdir -p ./backup first)
- Copy or move items between workspaces:
fab cp "dev.Workspace/Item.Notebook" "prod.Workspace" -f or fab mv "ws.Workspace/Old.Notebook" "ws.Workspace/New.Notebook" -f
- Delete items:
- Soft-delete (recycle bin):
fab rm "ws/Item.Type" -f
- Hard/permanent delete (skips recycle bin, requires fab ≥ 1.6.1):
fab rm --hard "ws/Item.Type" -f
- Open item in Fabric via browser:
fab open "spaceparts-dev.SpaceParts/Amazing Report.Report"
- Using Fabric or Power BI APIs:
fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes" -X post -i '{"type":"Full"}' or fab api "workspaces/<ws-id>/items"
- Using Azure CLI (advanced) when Fabric CLI doesn't suffice:
- T-SQL over any SQL-capable item ; use
scripts/query_sql_endpoint.py (reuses az login via ActiveDirectoryAzCli; full walkthrough in querying-data.md)
- Pass a Key Vault secret to a consumer without ever reading, echoing, or persisting it:
az login --service-principal -u <appId> -t <tenantId> --password "$(az keyvault secret show --vault-name <vault> --name <secret> --query value -o tsv)" ; command substitution pipes the secret directly into the child process arg list, never stdout, a file, or a named shell variable
- Full fab-vs-az decision matrix: fab-vs-az-cli.md
Essential Concepts
For information about any concepts related to Power BI or Fabric you must search or fetch via the microsoft-learn MCP server (or the pbi-search CLI as an alternative) and ask the user questions with the AskUserQuestion tool; NEVER guess or make assumptions.
Workspaces
- Workspaces are containers for items like Notebooks (and other ETL items), Lakehouses (and other data items), SemanticModels, Reports (and other consumption items), and OrgApps.
- Workspaces can be assigned to different things:
- Deployment Pipelines for lifecycle management (Dev, Test, Prod, etc.)
- Domains for governance and tenant structuring
- Capacities for licensing and resources (Fabric or Premium capacities only; PPU and Pro work differently)
- Git repositories for Source Control via Git integration
Key Patterns
Pay special attention to each of the following areas when using the Fabric CLI
Path Format
Fabric uses filesystem-like paths with type extensions:
"WorkspaceName.Workspace/ItemName.ItemType"
You must quote paths with spaces and punctuation:
"Workspace Name.Workspace/Semantic Model Name.SemanticModel"
For lakehouses this is extended into files and tables:
WorkspaceName.Workspace/LakehouseName.Lakehouse/Files/FileName.extension or /WorkspaceName.Workspace/LakehouseName.Lakehouse/Tables/TableName
For Fabric capacities you have to use fab ls .capacities
Examples:
"Production Workspace.Workspace/Sales Report.Report"
Data.Workspace/MainLH.Lakehouse/Files/data.csv
Data.Workspace/MainLH.Lakehouse/Tables/dbo/customers
Common Item Types
.Workspace - Workspaces
.SemanticModel - Power BI datasets
.Report - Power BI reports
.Notebook - Fabric notebooks
.DataPipeline - Data pipelines
.Lakehouse / .Warehouse/ .SQLDatabase - Data artifacts
.SparkJobDefinition - Spark jobs
.AISkill - Fabric Data Agents
.MirroredDatabase / .MirroredWarehouse - Mirrored databases
.Environment - Spark environments
.UserDataFunction - User data functions
Full list: You must use fab desc or fab desc .<ItemType> to check syntax and types if the user asks about an item type not listed above.
JMESPath Queries
Filter and transform JSON responses with -q:
# Get single field
-q "id"
-q "displayName"
# Get nested field
-q "properties.sqlEndpointProperties"
-q "definition.parts[0]"
# Filter arrays
-q "value[?type=='Lakehouse']"
-q "value[?contains(name, 'prod')]"
# Get first element
-q "value[0]"
-q "definition.parts[?path=='model.tmdl'] | [0]"
Using fab api
fab has an api escape hatch that lets you use any API even if it doesn't have primary commands.
Variable Extraction Pattern
To use fab api you need item IDs. Extract them like this:
WS_ID=$(fab get "ws.Workspace" -q "id" | tr -d '"')
MODEL_ID=$(fab get "ws.Workspace/Model.SemanticModel" -q "id" | tr -d '"')
# Then use in API calls
fab api -A powerbi "groups/$WS_ID/datasets/$MODEL_ID/refreshes" -X post -i '{"type":"Full"}'
Admin APIs (Requires Admin Role)
Don't use admin commands or APIs if the user doesn't have Admin access. Here's some examples:
# Find semantic models by name (cross-workspace)
fab api "admin/items" -P "type=SemanticModel" -q "itemEntities[?contains(name, 'Sales')]"
# Find all notebooks
fab api "admin/items" -P "type=Notebook" -q "itemEntities[].{name:name,workspace:workspaceId}"
# Find all lakehouses
fab api "admin/items" -P "type=Lakehouse"
# Common types: SemanticModel, Report, Notebook, Lakehouse, Warehouse, DataPipeline, Ontology
For full admin API reference (cross-workspace discovery, tenant settings read/update, capacity/domain/workspace overrides, activity events): admin.md
Error Handling & Debugging
# Show response headers
fab api workspaces --show_headers
# Verbose output
fab get "Production.Workspace/Item" -v
# Save responses for debugging
fab api workspaces -o /tmp/workspaces.json
Common workflows
These are the most common workflows you'll encounter in Fabric
Finding or exploring workspaces, items, or metadata
| Command |
Purpose |
Example |
fab ls |
List workspaces / items |
fab ls "Sales.Workspace" -l |
fab exists |
Check if a path exists |
fab exists "Sales.Workspace/Model.SemanticModel" |
fab get |
Get item details |
fab get "Sales.Workspace" -q "id" |
fab desc |
Supported commands per type |
fab desc .SemanticModel |
Flags:
-l (long listing)
-a (show hidden items)
-q (JMESPath filter)
-v (verbose output)
-o (save response to file)
Fabric discovery follows a drill-down pattern:
- Browsing:
- List workspaces:
fab ls
- List items in a workspace:
fab ls "ws.Workspace" -l
- Confirm a path exists:
fab exists "ws.Workspace/Item"
- Check what commands an item type supports:
fab desc .<ItemType>
- Inspection:
- Get item details:
fab get "ws.Workspace/Item"
- Pull a single field:
fab get "ws.Workspace" -q "id"
- Cross-workspace search:
Check references before exploring:
Querying data
| Command |
Purpose |
Example |
fab get -q "definition" |
Get model schema |
fab get "ws.Workspace/Model.SemanticModel" -q "definition" -f |
fab api -A powerbi |
Execute DAX |
fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/executeQueries" -X post -i '{"queries":[{"query":"EVALUATE..."}]}' |
fab ls |
Browse files / tables |
fab ls "ws.Workspace/LH.Lakehouse/Files" |
fab table schema |
Lakehouse table schema |
fab table schema "ws.Workspace/LH.Lakehouse/Tables/sales" |
fab cp |
Upload / download OneLake file |
fab cp ./local.csv "ws.Workspace/LH.Lakehouse/Files/" |
duckdb + delta_scan |
Query Delta tables (requires DuckDB) |
duckdb -c "... delta_scan('abfss://<ws-id>@onelake.../<lh-id>/Tables/schema/table')" |
duckdb + read_csv/json |
Query raw files (requires DuckDB) |
duckdb -c "... read_csv('abfss://.../Files/data.csv')" |
Flags:
-A fabric|powerbi|storage|azure (API audience)
-X get|post|put|delete|patch (HTTP method)
-i (JSON body or file)
-f (skip sensitivity prompt on definition pulls).
Fabric exposes three query paths depending on the source; always prefer the wrapper scripts — they resolve IDs, hosts, and auth for you:
- Semantic models (DAX):
- Find model fields first:
fab get "ws.Workspace/Model.SemanticModel" -q "definition"
- Query:
scripts/execute_dax.py
- Lakehouses / Warehouses via Delta over OneLake (DuckDB):
- Lakehouse SQL endpoint, Warehouse, or SQL Database (T-SQL via
sqlcmd):
- Query any SQL-capable item:
scripts/query_sql_endpoint.py (auto-detects host per item type, reuses az login via ActiveDirectoryAzCli)
- Prefer this over DuckDB when you need
INFORMATION_SCHEMA, sys.* metadata, CTEs, or window functions
Check references before writing queries:
Changing metadata or access (descriptions, tags, endorsement, properties, bindings, permissions)
| Command |
Purpose |
Example |
fab set |
Update property |
fab set "ws.Workspace/Item" -q displayName -i "New Name" |
fab mv |
Rename / move item |
fab mv "ws/Old.Notebook" "ws/New.Notebook" -f |
fab acl ls |
List permissions |
fab acl ls "ws.Workspace" |
fab acl set |
Grant permission |
fab acl set "ws.Workspace" -I <objectId> -R Member |
fab acl rm |
Revoke permission |
fab acl rm "ws.Workspace" -I <upn> |
fab label set |
Set sensitivity label |
fab label set "ws/Nb.Notebook" --name Confidential |
Flags:
-q <field> + -i <value> (set a single property)
-I (object ID or UPN for fab acl)
-R Admin|Member|Contributor|Viewer (role for fab acl set)
-f (skip confirmation; ask user first if sensitivity labels are in play)
Metadata and access changes fall into a few groups:
- Properties (displayName, description, sensitivity config):
- Native update:
fab set "<path>" -q <field> -i "<value>"
- Capture current state first so you can revert:
fab get -v -o /tmp/before.json
- Endorsement, certification, and tags (no first-class
fab commands):
- Patch via
fab api with item-specific endpoints
- Tag workflow: tags.md
- Endorsement patterns: reference.md
- Folder placement:
- Move items between workspace subfolders: folders.md
- Access control and sensitivity labels:
- Grant / revoke:
fab acl set, fab acl rm
- Set sensitivity label:
fab label set
- Verify the principal first:
az ad user show
- Never change permissions or labels without explicit user confirmation
- Bindings:
Check references before changing metadata:
Working with workspaces
| Command |
Purpose |
Example |
fab mkdir |
Create workspace / item |
fab mkdir "New.Workspace" -P capacityname=MyCapacity |
fab assign |
Attach capacity / domain |
fab assign .capacities/cap.Capacity -W ws.Workspace -f |
fab unassign |
Detach capacity / domain |
fab unassign .capacities/cap.Capacity -W ws.Workspace |
fab start / fab stop |
Resume / pause capacity |
fab start .capacities/cap.Capacity |
fab cp -r |
Fork workspace |
fab cp "dev.Workspace" "prod.Workspace" -r -f |
fab rm |
Soft-delete (recycle bin) |
fab rm "ws/Item.Type" -f |
fab rm --hard |
Hard/permanent delete (no recycle bin; fab ≥ 1.6.1) |
fab rm --hard "ws/Item.Type" -f |
fab deploy |
CI/CD deploy via fabric-cicd (fab ≥ 1.5.0) |
fab deploy -w prod.Workspace -s ./pipeline.yml |
Flags:
-P key=value (creation params for fab mkdir)
-W (target workspace for fab assign / fab unassign)
-r (recursive copy/move)
-bpc (block on path collision for fab cp)
-f (skip confirmation)
Workspace-scope operations fall into a few groups:
- Create and provision:
- Create workspace:
fab mkdir "<Name>.Workspace" -P capacityname=<cap>
- Attach capacity or domain:
fab assign .capacities/<cap>.Capacity -W <ws>.Workspace
- Planning context, create/get/set surface, large storage format, Spark pools, OneLake defaults, Git: workspaces.md
- Copy, fork, download:
- Duplicate a workspace in-tenant:
fab cp -r "dev.Workspace" "prod.Workspace"
- Dry-run the source tree first:
fab ls "dev.Workspace"
- Full local snapshot (items + lakehouse files):
scripts/download_workspace.py
- Permissions:
- Inspect / grant / revoke:
fab acl ls | set | rm
- Tenant-wide governance audit: use the
audit-tenant-settings skill from the fabric-admin plugin
- Connections and gateways (bound to, but outside, the workspace):
- Credential types (WorkspaceIdentity, SPN, Basic), OAuth2 limits: connections.md
- Datasource binding, credential rotation: gateways.md
- Folders inside a workspace:
Check references before modifying workspaces:
Executing or scheduling jobs (notebooks, notebook cells, pipelines, semantic model refresh)
| Command |
Purpose |
Example |
fab job run |
Run synchronously |
fab job run "ws/ETL.Notebook" -P date:string=2025-01-01 |
fab job start |
Run asynchronously |
fab job start "ws/ETL.Notebook" |
fab job run-list |
List executions |
fab job run-list "ws/Nb.Notebook" |
fab job run-status |
Check status |
fab job run-status "ws/Nb.Notebook" --id <job-id> |
fab job run-cancel |
Cancel a job |
fab job run-cancel "ws/Nb.Notebook" --id <job-id> -w |
fab api -A powerbi .../refreshes |
Trigger semantic model refresh |
fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes" -X post -i '{"type":"Full"}' |
Flags:
-P key:type=value (parameters, type is string|int|bool)
--id (job run ID)
-w (wait on cancel)
--timeout (overall timeout for synchronous runs)
--polling_interval (status poll cadence)
Jobs map to different endpoints depending on item type:
- Notebooks and pipelines:
- Run synchronously:
fab job run "ws/ETL.Notebook" -P date:string=2025-01-01
- Run asynchronously:
fab job start "ws/ETL.Notebook"
- Check status:
fab job run-status "ws/Nb.Notebook" --id <job-id>
- List history:
fab job run-list "ws/Nb.Notebook"
- Python / PySpark kernels, Livy sessions, cell-level CRUD: notebooks.md
- Semantic model refresh (not exposed as
fab job):
- Trigger:
fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes" -X post -i '{"type":"Full"}'
- Check current run before starting a new one (409 if already running):
fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes?\$top=1"
- Enhanced refresh, incremental policies, partition targeting: semantic-models.md
- Dataflow refresh:
- Scheduling:
Check references before running jobs:
Fabric admin operations (auditing, management)
| Command |
Purpose |
Example |
fab api "admin/items" |
Cross-workspace item search |
fab api "admin/items" -P "type=SemanticModel" -q "itemEntities[?contains(name,'Sales')]" |
fab api "admin/workspaces" |
Workspace inventory |
fab api "admin/workspaces" |
fab api "admin/tenantsettings" |
Tenant settings |
fab api "admin/tenantsettings" |
fab api "admin/capacities" |
Capacity inventory |
fab api "admin/capacities" |
fab api -X post .../update |
Update tenant setting |
fab api -X post "admin/tenantsettings/<name>/update" -i body.json |
Flags:
-P key=value (query params, e.g. type=SemanticModel)
-q (JMESPath filter)
-X post + -i (write ops)
--show_headers (inspect Retry-After on 429)
Admin-scope work is gated behind the Fabric / Power BI admin role. Confirm access first with fab api "admin/capacities" 2>&1 | head -5; if it errors, stop rather than retry.
Two entry points cover most admin tasks:
- Governance audits (tenant settings, delegated overrides, Entra SG scoping):
- Use the
audit-tenant-settings skill from the fabric-admin plugin. It owns the curated metadata baseline, the audit + change-detection script, delegated-override enumeration, and the Entra SG investigation workflow.
- Invoke it whenever the question combines tenant posture with group membership, override scope, or drift against the baseline.
- Raw admin APIs (cross-workspace search, activity events, artifact access, item search):
- Patterns in admin.md
- Rate limit: 25 write requests / minute; honor
Retry-After on 429
- Print the exact command and wait for user confirmation before any destructive admin operation
Check references before admin work:
Definitions and deployment (item definitions, deployment pipelines, git integration, cicd)
| Command |
Purpose |
Example |
fab get -q "definition" |
Read raw definition |
fab get "ws/Model.SemanticModel" -q "definition" -f |
fab export |
Export item to local |
fab export "ws/Nb.Notebook" -o ./backup -f |
fab import |
Import item from local |
fab import "ws/Nb.Notebook" -i ./backup/Nb.Notebook -f |
fab cp |
Copy between workspaces |
fab cp "dev/Item" "prod.Workspace" -f |
fab api "deploymentPipelines" |
Deployment pipelines API |
fab api "deploymentPipelines" -q "value[]" |
Flags:
-o (output path for fab export)
-i (input path or JSON body for fab import)
--format (definition format for export / import)
-f (skip overwrite and sensitivity prompts)
Every Fabric item has a serializable definition. Move definitions between environments depending on scope:
- Single item:
- Round-trip locally:
fab export then fab import (always mkdir -p the output directory first; fab export does not create intermediate directories and fails with [InvalidPath])
- Same-tenant shortcut, no local hop:
fab cp "dev/Item" "prod.Workspace"
- Semantic model as PBIP (TMDL + blank report):
- Full workspace snapshot (items + lakehouse files):
- Promotion between Dev, Test, Prod:
fab deploy (fab ≥ 1.5.0): integrates with fabric-cicd; replaces hand-rolled deploy scripts for most cases; recommended default
- Fabric deployment pipelines API (covers all item types, finer-grained control)
- Power BI pipelines API (Power BI items only; flags like
allowPurgeData, allowTakeOver)
- When to use each, selective deploy, LRO polling: deployment-pipelines.md
- Git integration (connect workspace to repo, branch, commit, update from git):
Check references before deploying:
Related skills
audit-tenant-settings (in the fabric-admin plugin) ; Fabric governance workflow covering tenant settings, delegated overrides (capacity / domain / workspace), and the Entra security groups those settings reference. Read-only; holds the curated metadata baseline and the audit + change-detection script.
Interactive REPL
Run fab with no arguments to enter an interactive session (fab ≥ 1.4.0). Tab-completion and persistent auth across commands.
fab # enter REPL
fab config set mode interactive # make interactive the default
Useful when running multiple commands in sequence — avoids re-auth overhead per call.
Fab CLI version history
Minimum version for features used in this skill: ≥ 1.6.1.
| Version |
Key additions |
| 1.6.1 (2026-04-29) |
fab find cross-workspace catalog search · fab rm --hard permanent delete · Lakehouse import/export · VariableLibrary full CRUD · Map + DigitalTwinBuilder item types |
| 1.5.0 (2026-03-12) |
fab deploy (fabric-cicd integration) · Semantic Model + SparkJobDefinition export/import |
| 1.4.0 (2026-02-09) |
Interactive REPL (fab with no args) · fab export --format (.ipynb/.py) · fab connection set/rm · fab get includes properties · new types: CosmosDBDatabase, UserDataFunction, GraphQuerySet |
Source: Fabric CLI release notes.
Gotchas
- IMPORTANT: DON'T try to use
fab ls on items that aren't data items (.Lakehouse, .Warehouse, etc); use fab ls to find workspaces and items, and use fab get to look at definitions
- ALWAYS Use the
-f flag when using fab get, fab import, fab export, etc. as described above
- ONLY fallback to
fab api when a command doesn't exist
fab find requires fab ≥ 1.6.1; fall back to scripts/search_across_workspaces.py on older installs
fab rm --hard bypasses the recycle bin — no recovery possible; confirm with user before use
References
Skill references:
- Import, Download, and Deploy - Export / import / copy / move items, PBIP round-trips, dev-to-prod migration patterns
- Querying Data - Query semantic models in DAX and lakehouses or warehouses in SQL with DuckDB
- Lakehouses - Endpoints, file/table operations, OneLake paths
- Warehouses - Create, browse, query via DuckDB, load data
- SQL Databases - Create, browse, query via DuckDB, auto-mirroring
- Semantic Models - TMDL, DAX, refresh, storage mode
- Reports - Export, import, visuals, fields
- Paginated Reports - RDL upload, export-to-file, datasources, parameters
- Notebooks - Python/PySpark kernels, metadata, cell CRUD, Livy execution, scheduling
- Workspaces - Create, manage, permissions
- Permissions - Sharing and distribution, workspace roles, item permissions, apps, embed, B2B, deployment pipeline permissions, licensing and capacity SKUs
- Deployment Pipelines - CI/CD, deploy stages, selective deploy, LRO polling
- Dataflows - Gen1 and Gen2, refresh, publish, admin
- Dashboards - Tiles, clone (dashboards are not reports)
- Org Apps - Read-only API for distributed content packages
- Scorecards - Goals, check-ins, status rules (Preview API)
- Gateways - Datasources, credentials, dataset binding
- Folders - Organize items into folders via API; includes best practices for structuring workspaces
- Tags - Create, apply, and audit tenant/domain tags on items and workspaces via
fab api (no native fab tag command)
- fab vs az CLI - When to use which; capacity, networking, Key Vault, monitoring, CMK, CI/CD
- Admin APIs - Cross-workspace search, tenant operations, governance
- API Reference - Capacities, domains, misc API patterns
- Connections - Create, update, list connections programmatically; credential types (WorkspaceIdentity, SPN, Basic); OAuth2 limitations
- Full Command Reference - All commands detailed
Scripts (scripts that you can execute):
- search_across_workspaces.py ; cross-workspace item search via DataHub V2 API; filters by type, owner, storage mode, last visited, capacity SKU
- get-downstream-reports.py ; find all reports connected to a given semantic model across accessible workspaces (no admin required)
- execute_dax.py ; execute DAX queries against semantic models; output as table, csv, or json
- query_lakehouse_duckdb.py ; query lakehouse or warehouse Delta tables via DuckDB against OneLake (reuses
az login); output as table, csv, or json
- query_sql_endpoint.py ; query lakehouse SQL endpoint, warehouse, or SQL database via
sqlcmd (reuses az login through ActiveDirectoryAzCli); output as table, csv, or json
- create_direct_lake_model.py ; create a Direct Lake semantic model from lakehouse tables
- export_semantic_model_as_pbip.py ; export a semantic model as a PBIP project (TMDL definition + blank report)
- download_workspace.py ; download a full workspace with all item definitions and lakehouse files
See scripts/README.md for detailed usage, arguments, and examples. Always search the scripts/ folder before writing a new helper; a script may already exist for the task.
External references (request markdown when possible):
1---2name: powerbi-fabric-cli3description: Expert guidance for using the Fabric CLI (`fab`) to fully interact with Fabric workspaces, items, and configuration. Automatically invoke this skill whenever the user mentions "Fabric" or "Power BI Service" or a "Fabric/Power BI workspace".4license: MIT5---67# Fabric CLI89Guidance for using `fab` to programmatically manage Fabric & Power BI service1011- Install via `uv tool install ms-fabric-cli` (get `uv` via `winget install uv` or `brew install uv`)12- Fabric CLI is for working with the Cloud environment and not local files; it works with Power BI Pro, PPU, or Fabric; you DO NOT need a Fabric SKU to use the Fabric CLI13- **Target version: ≥ 1.6.1.** Older versions lack `fab find`, the interactive REPL, `--format` on export, `fab deploy`, and several item types. Run `fab --version` to confirm. Key version deltas in [Fab CLI version history](#fab-cli-version-history) below.1415> [!IMPORTANT] 16> Any time you encounter errors, user preferences or learnings when using the Fabric cli, ALWAYS note these down in the user memory rules, i.e. `.claude/rules/fabric-cli.md` for future improvement. 17> This is ONLY for generic learnings and not for item- or task-specific learnings.1819## When to use this skill2021- Use whenever the user mentions "Fabric" or "Power BI"22- Use when user asks about Power BI workspaces, deployment, tenants, publishing, download, permissions, or data232425## Critical general rules2627- IMPORTANT: The first time you use `fab` run check that it is up to date to the latest version and run `fab auth status`; If user isn't authenticated, ask them to run `fab auth login`28- Always use `fab --help` and `fab <command> --help` the first time you use a command to understand its syntax29- You must search the skill /references/ for relevant reference files that explain certain commands, examples, scripts, or workflows before you start using `fab`30- Before first use, ask the user if they have Fabric admin access, sensitivity labels or DLP policies, any API restrictions, or preferences for Fabric/Power BI API usage; remind user to add this to memory files31- If workspace or item name is unclear, ask the user first, then verify with `fab ls` or `fab exists` before proceeding32- Ensure that you avoid removing or moving items, workspaces, or definitions, or changing properties without explicit user direction33- If a command is blocked in your permissions and you try to use it, stop and ask the user for clarification; never try to circumvent it34- Create output directories before export: `fab export` does not create intermediate directories; `mkdir -p` the output path first or the command fails with `[InvalidPath]`353637### Use `-f` (force) for non-interactive use3839The `fab` CLI prompts for confirmation, so you **you must always append `-f`** to prevent this UNLESS sensitivity labels are enabled, in which case you must ask the user. Do this for the commands:4041- `fab get -q "definition"` ; sensitivity label confirmation42- `fab export` ; sensitivity label confirmation43- `fab import` ; overwrite confirmation44- `fab cp` / `fab cp -r` ; overwrite and sensitivity label confirmation45- `fab rm` ; delete confirmation46- `fab assign` / `fab unassign` ; capacity/domain assignment confirmation47- `fab mv` ; rename/move confirmation484950## Quickstart guide5152You must read and understand the common list of operations with simple examples53540. Check the commands, syntax, and auth status: `fab --help` and `fab auth status`551. Check if the item exists if the user gave the workspace and item name: `fab exists "spaceparts-dev.Workspace/spaceparts-otc-full.SemanticModel"`562. Find an item by name across all accessible workspaces: `fab find 'sales' -P type=Report -l` (requires fab ≥ 1.6.1; substring on name/description/workspace; `-P type=X` to filter by type; `-l` for IDs; `-q '<jmespath>'` for client-side projection)57 - For governance fields not returned by `fab find` (last visit, last refresh, owner, storage mode, capacity SKU): use `scripts/search_across_workspaces.py` instead583. Find the workspace: `fab ls`594. Find the item: `fab ls "Workspace Name.Workspace"`605. Check the commands for that item:61 - `fab desc` to get itemTypes62 - `fab desc .<ItemType>` for commands i.e. `fab desc .SemanticModel`636. What's in that item; what's it for; what is it?:64 - Full TMDL definition: `fab get "spaceparts-dev.Workspace/spaceparts-otc-full.SemanticModel" -q "definition" -f`65 - Search a specific measure / table / column: `fab get "ws.Workspace/Model.SemanticModel" -q "definition" -f | rga -i "Sales Amount"`667. Get files, tables, or table schemas:67 - List lakehouse files: `fab ls "ws.Workspace/LH.Lakehouse/Files"`68 - List lakehouse tables: `fab ls "ws.Workspace/LH.Lakehouse/Tables"`69 - Table schema: `fab table schema "ws.Workspace/LH.Lakehouse/Tables/gold/orders"`708. Query data (always prefer the wrapper scripts over raw `fab api` / `duckdb` / `sqlcmd`; they resolve IDs, hosts, and auth for you):71 - Semantic model (DAX): `python3 scripts/execute_dax.py "ws.Workspace/Model.SemanticModel" -q "EVALUATE TOPN(10, 'Orders')"`72 - Lakehouse or warehouse (DuckDB + Delta against OneLake): `python3 scripts/query_lakehouse_duckdb.py "ws.Workspace/LH.Lakehouse" -q "SELECT * FROM tbl LIMIT 10" -t gold.orders`73 - Lakehouse SQL endpoint, warehouse, or SQL database (T-SQL via `sqlcmd` + `az` session): `python3 scripts/query_sql_endpoint.py "ws.Workspace/LH.Lakehouse" -q "SELECT TOP 10 * FROM dbo.orders"`749. Set properties for an item or workspace: `fab set "ws.Workspace/Item.Notebook" -q displayName -i "New Name"` or `fab set "ws.Workspace" -q description -i "Production environment"`7510. Review or manage permissions:76 - Item ACL: `fab acl ls "ws.Workspace/Model.SemanticModel"` then `fab acl set "ws.Workspace/Model.SemanticModel" -I user@contoso.com -R Read`77 - Workspace roles: `fab acl ls "ws.Workspace"` then `fab acl set "ws.Workspace" -I user@contoso.com -R Member`7811. Deploy items to Fabric:79 - Single item: `fab import "ws.Workspace/New.Notebook" -i ./local-path/Nb.Notebook -f`80 - Multi-item CI/CD pipeline (dev→test→prod): `fab deploy` (requires fab ≥ 1.5.0, integrates with fabric-cicd; replaces hand-rolled deploy scripts)8112. Download items from Fabric: `fab export "ws.Workspace/Nb.Notebook" -o ./backup -f` (always `mkdir -p ./backup` first)8213. Copy or move items between workspaces: `fab cp "dev.Workspace/Item.Notebook" "prod.Workspace" -f` or `fab mv "ws.Workspace/Old.Notebook" "ws.Workspace/New.Notebook" -f`8314. Delete items:84 - Soft-delete (recycle bin): `fab rm "ws/Item.Type" -f`85 - Hard/permanent delete (skips recycle bin, requires fab ≥ 1.6.1): `fab rm --hard "ws/Item.Type" -f`8615. Open item in Fabric via browser: `fab open "spaceparts-dev.SpaceParts/Amazing Report.Report"`8716. Using Fabric or Power BI APIs: `fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes" -X post -i '{"type":"Full"}'` or `fab api "workspaces/<ws-id>/items"`8817. Using [Azure CLI](./references/fab-vs-az-cli.md) (advanced) when Fabric CLI doesn't suffice:89 - T-SQL over any SQL-capable item ; use [`scripts/query_sql_endpoint.py`](./scripts/query_sql_endpoint.py) (reuses `az login` via `ActiveDirectoryAzCli`; full walkthrough in [querying-data.md](./references/querying-data.md#sqlcmd-over-lakehouse-warehouse-and-sql-database))90 - Pass a Key Vault secret to a consumer without ever reading, echoing, or persisting it: `az login --service-principal -u <appId> -t <tenantId> --password "$(az keyvault secret show --vault-name <vault> --name <secret> --query value -o tsv)"` ; command substitution pipes the secret directly into the child process arg list, never stdout, a file, or a named shell variable91 - Full fab-vs-az decision matrix: [fab-vs-az-cli.md](./references/fab-vs-az-cli.md)929394## Essential Concepts9596For information about any concepts related to Power BI or Fabric you must search or fetch via the `microsoft-learn` MCP server (or the `pbi-search` CLI as an alternative) and ask the user questions with the `AskUserQuestion` tool; NEVER guess or make assumptions.9798### Workspaces99100- **Workspaces** are containers for **items** like Notebooks (and other ETL items), Lakehouses (and other data items), SemanticModels, Reports (and other consumption items), and OrgApps.101- Workspaces can be assigned to different things:102 - Deployment Pipelines for lifecycle management (Dev, Test, Prod, etc.)103 - Domains for governance and tenant structuring104 - Capacities for licensing and resources (Fabric or Premium capacities only; PPU and Pro work differently)105 - Git repositories for Source Control via Git integration106107108## Key Patterns109110Pay special attention to each of the following areas when using the Fabric CLI111112113### Path Format114115Fabric uses filesystem-like paths with type extensions:116117`"WorkspaceName.Workspace/ItemName.ItemType"`118119You must quote paths with spaces and punctuation:120121`"Workspace Name.Workspace/Semantic Model Name.SemanticModel"`122123For lakehouses this is extended into files and tables:124125`WorkspaceName.Workspace/LakehouseName.Lakehouse/Files/FileName.extension` or `/WorkspaceName.Workspace/LakehouseName.Lakehouse/Tables/TableName`126127For Fabric capacities you have to use `fab ls .capacities`128129Examples:130131- `"Production Workspace.Workspace/Sales Report.Report"`132- `Data.Workspace/MainLH.Lakehouse/Files/data.csv`133- `Data.Workspace/MainLH.Lakehouse/Tables/dbo/customers`134135136### Common Item Types137138- `.Workspace` - Workspaces139- `.SemanticModel` - Power BI datasets140- `.Report` - Power BI reports141- `.Notebook` - Fabric notebooks142- `.DataPipeline` - Data pipelines143- `.Lakehouse` / `.Warehouse`/ `.SQLDatabase` - Data artifacts144- `.SparkJobDefinition` - Spark jobs145- `.AISkill` - Fabric Data Agents146- `.MirroredDatabase` / `.MirroredWarehouse` - Mirrored databases147- `.Environment` - Spark environments148- `.UserDataFunction` - User data functions149150Full list: You must use `fab desc` or `fab desc .<ItemType>` to check syntax and types if the user asks about an item type not listed above.151152153### JMESPath Queries154155Filter and transform JSON responses with `-q`:156157```bash158# Get single field159-q "id"160-q "displayName"161162# Get nested field163-q "properties.sqlEndpointProperties"164-q "definition.parts[0]"165166# Filter arrays167-q "value[?type=='Lakehouse']"168-q "value[?contains(name, 'prod')]"169170# Get first element171-q "value[0]"172-q "definition.parts[?path=='model.tmdl'] | [0]"173```174175### Using `fab api`176177`fab` has an api escape hatch that lets you use any API even if it doesn't have primary commands.178179180#### Variable Extraction Pattern181182To use `fab api` you need item IDs. Extract them like this:183184```bash185WS_ID=$(fab get "ws.Workspace" -q "id" | tr -d '"')186MODEL_ID=$(fab get "ws.Workspace/Model.SemanticModel" -q "id" | tr -d '"')187188# Then use in API calls189fab api -A powerbi "groups/$WS_ID/datasets/$MODEL_ID/refreshes" -X post -i '{"type":"Full"}'190```191192193#### Admin APIs (Requires Admin Role)194195Don't use admin commands or APIs if the user doesn't have Admin access. Here's some examples:196197```bash198# Find semantic models by name (cross-workspace)199fab api "admin/items" -P "type=SemanticModel" -q "itemEntities[?contains(name, 'Sales')]"200201# Find all notebooks202fab api "admin/items" -P "type=Notebook" -q "itemEntities[].{name:name,workspace:workspaceId}"203204# Find all lakehouses205fab api "admin/items" -P "type=Lakehouse"206207# Common types: SemanticModel, Report, Notebook, Lakehouse, Warehouse, DataPipeline, Ontology208```209210For full admin API reference (cross-workspace discovery, tenant settings read/update, capacity/domain/workspace overrides, activity events): [admin.md](./references/admin.md)211212213### Error Handling & Debugging214215```bash216# Show response headers217fab api workspaces --show_headers218219# Verbose output220fab get "Production.Workspace/Item" -v221222# Save responses for debugging223fab api workspaces -o /tmp/workspaces.json224```225226227## Common workflows228229These are the most common workflows you'll encounter in Fabric230231### Finding or exploring workspaces, items, or metadata232233| Command | Purpose | Example |234|---|---|---|235| `fab ls` | List workspaces / items | `fab ls "Sales.Workspace" -l` |236| `fab exists` | Check if a path exists | `fab exists "Sales.Workspace/Model.SemanticModel"` |237| `fab get` | Get item details | `fab get "Sales.Workspace" -q "id"` |238| `fab desc` | Supported commands per type | `fab desc .SemanticModel` |239240Flags:241- `-l` (long listing)242- `-a` (show hidden items)243- `-q` (JMESPath filter)244- `-v` (verbose output)245- `-o` (save response to file)246247Fabric discovery follows a drill-down pattern:248249- Browsing:250 - List workspaces: `fab ls`251 - List items in a workspace: `fab ls "ws.Workspace" -l`252 - Confirm a path exists: `fab exists "ws.Workspace/Item"`253 - Check what commands an item type supports: `fab desc .<ItemType>`254- Inspection:255 - Get item details: `fab get "ws.Workspace/Item"`256 - Pull a single field: `fab get "ws.Workspace" -q "id"`257- Cross-workspace search:258 - Routine discovery by name/type (no admin required): `fab find '<text>' -P type=<Type> -l` (fab ≥ 1.6.1)259 - Governance metadata not in `fab find` (last visit, last refresh, owner, storage mode, capacity SKU): [`scripts/search_across_workspaces.py`](./scripts/search_across_workspaces.py)260 - Downstream reports for a given model: [`scripts/get-downstream-reports.py`](./scripts/get-downstream-reports.py)261 - Tenant-wide admin APIs: [admin.md](./references/admin.md)262263Check references before exploring:264265- [workspaces.md](./references/workspaces.md)266- [folders.md](./references/folders.md)267- [admin.md](./references/admin.md)268- [reference.md](./references/reference.md)269270271### Querying data272273| Command | Purpose | Example |274|---|---|---|275| `fab get -q "definition"` | Get model schema | `fab get "ws.Workspace/Model.SemanticModel" -q "definition" -f` |276| `fab api -A powerbi` | Execute DAX | `fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/executeQueries" -X post -i '{"queries":[{"query":"EVALUATE..."}]}'` |277| `fab ls` | Browse files / tables | `fab ls "ws.Workspace/LH.Lakehouse/Files"` |278| `fab table schema` | Lakehouse table schema | `fab table schema "ws.Workspace/LH.Lakehouse/Tables/sales"` |279| `fab cp` | Upload / download OneLake file | `fab cp ./local.csv "ws.Workspace/LH.Lakehouse/Files/"` |280| `duckdb` + `delta_scan` | Query Delta tables (requires DuckDB) | `duckdb -c "... delta_scan('abfss://<ws-id>@onelake.../<lh-id>/Tables/schema/table')"` |281| `duckdb` + `read_csv/json` | Query raw files (requires DuckDB) | `duckdb -c "... read_csv('abfss://.../Files/data.csv')"` |282283Flags: 284- `-A fabric|powerbi|storage|azure` (API audience)285- `-X get|post|put|delete|patch` (HTTP method)286- `-i` (JSON body or file)287- `-f` (skip sensitivity prompt on definition pulls).288289Fabric exposes three query paths depending on the source; always prefer the wrapper scripts — they resolve IDs, hosts, and auth for you:290291- Semantic models (DAX):292 - Find model fields first: `fab get "ws.Workspace/Model.SemanticModel" -q "definition"`293 - Query: [`scripts/execute_dax.py`](./scripts/execute_dax.py)294- Lakehouses / Warehouses via Delta over OneLake (DuckDB):295 - Query a single table: [`scripts/query_lakehouse_duckdb.py`](./scripts/query_lakehouse_duckdb.py) (use `tbl` as a placeholder and pass `-t schema.table`)296 - Multi-table joins or raw files in `Files/`: pass `--sql` with your own `delta_scan()` / `read_csv` / `read_json_auto` calls297 - Optionally scaffold a Direct Lake model instead: [`scripts/create_direct_lake_model.py`](./scripts/create_direct_lake_model.py)298- Lakehouse SQL endpoint, Warehouse, or SQL Database (T-SQL via `sqlcmd`):299 - Query any SQL-capable item: [`scripts/query_sql_endpoint.py`](./scripts/query_sql_endpoint.py) (auto-detects host per item type, reuses `az login` via `ActiveDirectoryAzCli`)300 - Prefer this over DuckDB when you need `INFORMATION_SCHEMA`, `sys.*` metadata, CTEs, or window functions301302Check references before writing queries:303304- [querying-data.md](./references/querying-data.md)305- [semantic-models.md](./references/semantic-models.md)306- [lakehouses.md](./references/lakehouses.md)307- [warehouses.md](./references/warehouses.md)308- [sql-databases.md](./references/sql-databases.md)309310311### Changing metadata or access (descriptions, tags, endorsement, properties, bindings, permissions)312313| Command | Purpose | Example |314|---|---|---|315| `fab set` | Update property | `fab set "ws.Workspace/Item" -q displayName -i "New Name"` |316| `fab mv` | Rename / move item | `fab mv "ws/Old.Notebook" "ws/New.Notebook" -f` |317| `fab acl ls` | List permissions | `fab acl ls "ws.Workspace"` |318| `fab acl set` | Grant permission | `fab acl set "ws.Workspace" -I <objectId> -R Member` |319| `fab acl rm` | Revoke permission | `fab acl rm "ws.Workspace" -I <upn>` |320| `fab label set` | Set sensitivity label | `fab label set "ws/Nb.Notebook" --name Confidential` |321322Flags:323- `-q <field>` + `-i <value>` (set a single property)324- `-I` (object ID or UPN for `fab acl`)325- `-R Admin|Member|Contributor|Viewer` (role for `fab acl set`)326- `-f` (skip confirmation; ask user first if sensitivity labels are in play)327328Metadata and access changes fall into a few groups:329330- Properties (displayName, description, sensitivity config):331 - Native update: `fab set "<path>" -q <field> -i "<value>"`332 - Capture current state first so you can revert: `fab get -v -o /tmp/before.json`333- Endorsement, certification, and tags (no first-class `fab` commands):334 - Patch via `fab api` with item-specific endpoints335 - Tag workflow: [tags.md](./references/tags.md)336 - Endorsement patterns: [reference.md](./references/reference.md)337- Folder placement:338 - Move items between workspace subfolders: [folders.md](./references/folders.md)339- Access control and sensitivity labels:340 - Grant / revoke: `fab acl set`, `fab acl rm`341 - Set sensitivity label: `fab label set`342 - Verify the principal first: `az ad user show`343 - Never change permissions or labels without explicit user confirmation344- Bindings:345 - Rebind a thin `.Report` to a different `.SemanticModel`: [reports.md](./references/reports.md)346 - Semantic model source rebinds (e.g. swap a lakehouse): [semantic-models.md](./references/semantic-models.md)347348Check references before changing metadata:349350- [reference.md](./references/reference.md)351- [tags.md](./references/tags.md)352- [folders.md](./references/folders.md)353- [reports.md](./references/reports.md)354- [semantic-models.md](./references/semantic-models.md)355356### Working with workspaces357358| Command | Purpose | Example |359|---|---|---|360| `fab mkdir` | Create workspace / item | `fab mkdir "New.Workspace" -P capacityname=MyCapacity` |361| `fab assign` | Attach capacity / domain | `fab assign .capacities/cap.Capacity -W ws.Workspace -f` |362| `fab unassign` | Detach capacity / domain | `fab unassign .capacities/cap.Capacity -W ws.Workspace` |363| `fab start` / `fab stop` | Resume / pause capacity | `fab start .capacities/cap.Capacity` |364| `fab cp -r` | Fork workspace | `fab cp "dev.Workspace" "prod.Workspace" -r -f` |365| `fab rm` | Soft-delete (recycle bin) | `fab rm "ws/Item.Type" -f` |366| `fab rm --hard` | Hard/permanent delete (no recycle bin; fab ≥ 1.6.1) | `fab rm --hard "ws/Item.Type" -f` |367| `fab deploy` | CI/CD deploy via fabric-cicd (fab ≥ 1.5.0) | `fab deploy -w prod.Workspace -s ./pipeline.yml` |368369Flags:370- `-P key=value` (creation params for `fab mkdir`)371- `-W` (target workspace for `fab assign` / `fab unassign`)372- `-r` (recursive copy/move)373- `-bpc` (block on path collision for `fab cp`)374- `-f` (skip confirmation)375376Workspace-scope operations fall into a few groups:377378- Create and provision:379 - Create workspace: `fab mkdir "<Name>.Workspace" -P capacityname=<cap>`380 - Attach capacity or domain: `fab assign .capacities/<cap>.Capacity -W <ws>.Workspace`381 - Planning context, create/get/set surface, large storage format, Spark pools, OneLake defaults, Git: [workspaces.md](./references/workspaces.md)382- Copy, fork, download:383 - Duplicate a workspace in-tenant: `fab cp -r "dev.Workspace" "prod.Workspace"`384 - Dry-run the source tree first: `fab ls "dev.Workspace"`385 - Full local snapshot (items + lakehouse files): [`scripts/download_workspace.py`](./scripts/download_workspace.py)386- Permissions:387 - Inspect / grant / revoke: `fab acl ls | set | rm`388 - Tenant-wide governance audit: use the `audit-tenant-settings` skill from the `fabric-admin` plugin389- Connections and gateways (bound to, but outside, the workspace):390 - Credential types (WorkspaceIdentity, SPN, Basic), OAuth2 limits: [connections.md](./references/connections.md)391 - Datasource binding, credential rotation: [gateways.md](./references/gateways.md)392- Folders inside a workspace:393 - Layout, nesting, conventions: [folders.md](./references/folders.md)394395Check references before modifying workspaces:396397- [workspaces.md](./references/workspaces.md)398- [folders.md](./references/folders.md)399- [connections.md](./references/connections.md)400- [gateways.md](./references/gateways.md)401402403### Executing or scheduling jobs (notebooks, notebook cells, pipelines, semantic model refresh)404405| Command | Purpose | Example |406|---|---|---|407| `fab job run` | Run synchronously | `fab job run "ws/ETL.Notebook" -P date:string=2025-01-01` |408| `fab job start` | Run asynchronously | `fab job start "ws/ETL.Notebook"` |409| `fab job run-list` | List executions | `fab job run-list "ws/Nb.Notebook"` |410| `fab job run-status` | Check status | `fab job run-status "ws/Nb.Notebook" --id <job-id>` |411| `fab job run-cancel` | Cancel a job | `fab job run-cancel "ws/Nb.Notebook" --id <job-id> -w` |412| `fab api -A powerbi .../refreshes` | Trigger semantic model refresh | `fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes" -X post -i '{"type":"Full"}'` |413414Flags:415- `-P key:type=value` (parameters, type is `string|int|bool`)416- `--id` (job run ID)417- `-w` (wait on cancel)418- `--timeout` (overall timeout for synchronous runs)419- `--polling_interval` (status poll cadence)420421Jobs map to different endpoints depending on item type:422423- Notebooks and pipelines:424 - Run synchronously: `fab job run "ws/ETL.Notebook" -P date:string=2025-01-01`425 - Run asynchronously: `fab job start "ws/ETL.Notebook"`426 - Check status: `fab job run-status "ws/Nb.Notebook" --id <job-id>`427 - List history: `fab job run-list "ws/Nb.Notebook"`428 - Python / PySpark kernels, Livy sessions, cell-level CRUD: [notebooks.md](./references/notebooks.md)429- Semantic model refresh (not exposed as `fab job`):430 - Trigger: `fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes" -X post -i '{"type":"Full"}'`431 - Check current run before starting a new one (409 if already running): `fab api -A powerbi "groups/<ws-id>/datasets/<model-id>/refreshes?\$top=1"`432 - Enhanced refresh, incremental policies, partition targeting: [semantic-models.md](./references/semantic-models.md)433- Dataflow refresh:434 - Gen1 and Gen2 have different endpoints: [dataflows.md](./references/dataflows.md)435- Scheduling:436 - Per-item schedules via the scheduler API: [notebooks.md](./references/notebooks.md), [reference.md](./references/reference.md)437438Check references before running jobs:439440- [notebooks.md](./references/notebooks.md)441- [semantic-models.md](./references/semantic-models.md)442- [dataflows.md](./references/dataflows.md)443- [reference.md](./references/reference.md)444445446### Fabric admin operations (auditing, management)447448| Command | Purpose | Example |449|---|---|---|450| `fab api "admin/items"` | Cross-workspace item search | `fab api "admin/items" -P "type=SemanticModel" -q "itemEntities[?contains(name,'Sales')]"` |451| `fab api "admin/workspaces"` | Workspace inventory | `fab api "admin/workspaces"` |452| `fab api "admin/tenantsettings"` | Tenant settings | `fab api "admin/tenantsettings"` |453| `fab api "admin/capacities"` | Capacity inventory | `fab api "admin/capacities"` |454| `fab api -X post .../update` | Update tenant setting | `fab api -X post "admin/tenantsettings/<name>/update" -i body.json` |455456Flags:457- `-P key=value` (query params, e.g. `type=SemanticModel`)458- `-q` (JMESPath filter)459- `-X post` + `-i` (write ops)460- `--show_headers` (inspect `Retry-After` on 429)461462Admin-scope work is gated behind the Fabric / Power BI admin role. Confirm access first with `fab api "admin/capacities" 2>&1 | head -5`; if it errors, stop rather than retry.463464Two entry points cover most admin tasks:465466- Governance audits (tenant settings, delegated overrides, Entra SG scoping):467 - Use the `audit-tenant-settings` skill from the `fabric-admin` plugin. It owns the curated metadata baseline, the audit + change-detection script, delegated-override enumeration, and the Entra SG investigation workflow.468 - Invoke it whenever the question combines tenant posture with group membership, override scope, or drift against the baseline.469- Raw admin APIs (cross-workspace search, activity events, artifact access, item search):470 - Patterns in [admin.md](./references/admin.md)471 - Rate limit: 25 write requests / minute; honor `Retry-After` on 429472 - Print the exact command and wait for user confirmation before any destructive admin operation473474Check references before admin work:475476- [admin.md](./references/admin.md)477- [permissions.md](./references/permissions.md) for workspace / item ACL exposure audits478479480### Definitions and deployment (item definitions, deployment pipelines, git integration, cicd)481482| Command | Purpose | Example |483|---|---|---|484| `fab get -q "definition"` | Read raw definition | `fab get "ws/Model.SemanticModel" -q "definition" -f` |485| `fab export` | Export item to local | `fab export "ws/Nb.Notebook" -o ./backup -f` |486| `fab import` | Import item from local | `fab import "ws/Nb.Notebook" -i ./backup/Nb.Notebook -f` |487| `fab cp` | Copy between workspaces | `fab cp "dev/Item" "prod.Workspace" -f` |488| `fab api "deploymentPipelines"` | Deployment pipelines API | `fab api "deploymentPipelines" -q "value[]"` |489490Flags:491- `-o` (output path for `fab export`)492- `-i` (input path or JSON body for `fab import`)493- `--format` (definition format for export / import)494- `-f` (skip overwrite and sensitivity prompts)495496Every Fabric item has a serializable definition. Move definitions between environments depending on scope:497498- Single item:499 - Round-trip locally: `fab export` then `fab import` (always `mkdir -p` the output directory first; `fab export` does not create intermediate directories and fails with `[InvalidPath]`)500 - Same-tenant shortcut, no local hop: `fab cp "dev/Item" "prod.Workspace"`501- Semantic model as PBIP (TMDL + blank report):502 - Power BI Desktop and git-ready format: [`scripts/export_semantic_model_as_pbip.py`](./scripts/export_semantic_model_as_pbip.py)503- Full workspace snapshot (items + lakehouse files):504 - Backups, offline analysis, cross-tenant forks: [`scripts/download_workspace.py`](./scripts/download_workspace.py)505- Promotion between Dev, Test, Prod:506 - `fab deploy` (fab ≥ 1.5.0): integrates with [fabric-cicd](https://github.com/microsoft/fabric-cicd); replaces hand-rolled deploy scripts for most cases; recommended default507 - Fabric deployment pipelines API (covers all item types, finer-grained control)508 - Power BI pipelines API (Power BI items only; flags like `allowPurgeData`, `allowTakeOver`)509 - When to use each, selective deploy, LRO polling: [deployment-pipelines.md](./references/deployment-pipelines.md)510- Git integration (connect workspace to repo, branch, commit, update from git):511 - Workspace git section in [workspaces.md](./references/workspaces.md)512513Check references before deploying:514515- [import-download-deploy.md](./references/import-download-deploy.md) ; export / import / copy / move, PBIP round-trips, migration patterns, rebinding gotchas516- [deployment-pipelines.md](./references/deployment-pipelines.md)517- [semantic-models.md](./references/semantic-models.md)518- [reports.md](./references/reports.md)519- [paginated-reports.md](./references/paginated-reports.md)520- [notebooks.md](./references/notebooks.md)521- [workspaces.md](./references/workspaces.md)522523524## Related skills525526- `audit-tenant-settings` (in the `fabric-admin` plugin) ; Fabric governance workflow covering tenant settings, delegated overrides (capacity / domain / workspace), and the Entra security groups those settings reference. Read-only; holds the curated metadata baseline and the audit + change-detection script.527528## Interactive REPL529530Run `fab` with no arguments to enter an interactive session (fab ≥ 1.4.0). Tab-completion and persistent auth across commands.531532```bash533fab # enter REPL534fab config set mode interactive # make interactive the default535```536537Useful when running multiple commands in sequence — avoids re-auth overhead per call.538539540## Fab CLI version history541542Minimum version for features used in this skill: **≥ 1.6.1**.543544| Version | Key additions |545|---|---|546| **1.6.1** (2026-04-29) | `fab find` cross-workspace catalog search · `fab rm --hard` permanent delete · Lakehouse import/export · `VariableLibrary` full CRUD · `Map` + `DigitalTwinBuilder` item types |547| **1.5.0** (2026-03-12) | `fab deploy` (fabric-cicd integration) · Semantic Model + SparkJobDefinition export/import |548| **1.4.0** (2026-02-09) | Interactive REPL (`fab` with no args) · `fab export --format` (`.ipynb`/`.py`) · `fab connection set/rm` · `fab get` includes `properties` · new types: CosmosDBDatabase, UserDataFunction, GraphQuerySet |549550Source: [Fabric CLI release notes](https://microsoft.github.io/fabric-cli/release-notes/).551552553## Gotchas554555- **IMPORTANT:** DON'T try to use `fab ls` on items that aren't data items (.Lakehouse, .Warehouse, etc); use `fab ls` to find workspaces and items, and use `fab get` to look at definitions556- ALWAYS Use the `-f` flag when using `fab get`, `fab import`, `fab export`, etc. as described above557- ONLY fallback to `fab api` when a command doesn't exist558- `fab find` requires fab ≥ 1.6.1; fall back to `scripts/search_across_workspaces.py` on older installs559- `fab rm --hard` bypasses the recycle bin — no recovery possible; confirm with user before use560561## References562563**Skill references:**564565- [Import, Download, and Deploy](./references/import-download-deploy.md) - Export / import / copy / move items, PBIP round-trips, dev-to-prod migration patterns566- [Querying Data](./references/querying-data.md) - Query semantic models in DAX and lakehouses or warehouses in SQL with DuckDB567- [Lakehouses](./references/lakehouses.md) - Endpoints, file/table operations, OneLake paths568- [Warehouses](./references/warehouses.md) - Create, browse, query via DuckDB, load data569- [SQL Databases](./references/sql-databases.md) - Create, browse, query via DuckDB, auto-mirroring570- [Semantic Models](./references/semantic-models.md) - TMDL, DAX, refresh, storage mode571- [Reports](./references/reports.md) - Export, import, visuals, fields572- [Paginated Reports](./references/paginated-reports.md) - RDL upload, export-to-file, datasources, parameters573- [Notebooks](./references/notebooks.md) - Python/PySpark kernels, metadata, cell CRUD, Livy execution, scheduling574- [Workspaces](./references/workspaces.md) - Create, manage, permissions575- [Permissions](./references/permissions.md) - Sharing and distribution, workspace roles, item permissions, apps, embed, B2B, deployment pipeline permissions, licensing and capacity SKUs576- [Deployment Pipelines](./references/deployment-pipelines.md) - CI/CD, deploy stages, selective deploy, LRO polling577- [Dataflows](./references/dataflows.md) - Gen1 and Gen2, refresh, publish, admin578- [Dashboards](./references/dashboards.md) - Tiles, clone (dashboards are not reports)579- [Org Apps](./references/org-apps.md) - Read-only API for distributed content packages580- [Scorecards](./references/scorecards.md) - Goals, check-ins, status rules (Preview API)581- [Gateways](./references/gateways.md) - Datasources, credentials, dataset binding582- [Folders](./references/folders.md) - Organize items into folders via API; includes best practices for structuring workspaces583- [Tags](./references/tags.md) - Create, apply, and audit tenant/domain tags on items and workspaces via `fab api` (no native `fab tag` command)584- [fab vs az CLI](./references/fab-vs-az-cli.md) - When to use which; capacity, networking, Key Vault, monitoring, CMK, CI/CD585- [Admin APIs](./references/admin.md) - Cross-workspace search, tenant operations, governance586- [API Reference](./references/fab-api.md) - Capacities, domains, misc API patterns587- [Connections](./references/connections.md) - Create, update, list connections programmatically; credential types (WorkspaceIdentity, SPN, Basic); OAuth2 limitations588- [Full Command Reference](./references/reference.md) - All commands detailed589590**Scripts** (scripts that you can execute):591592- [search_across_workspaces.py](./scripts/search_across_workspaces.py) ; cross-workspace item search via DataHub V2 API; filters by type, owner, storage mode, last visited, capacity SKU593- [get-downstream-reports.py](./scripts/get-downstream-reports.py) ; find all reports connected to a given semantic model across accessible workspaces (no admin required)594- [execute_dax.py](./scripts/execute_dax.py) ; execute DAX queries against semantic models; output as table, csv, or json595- [query_lakehouse_duckdb.py](./scripts/query_lakehouse_duckdb.py) ; query lakehouse or warehouse Delta tables via DuckDB against OneLake (reuses `az login`); output as table, csv, or json596- [query_sql_endpoint.py](./scripts/query_sql_endpoint.py) ; query lakehouse SQL endpoint, warehouse, or SQL database via `sqlcmd` (reuses `az login` through `ActiveDirectoryAzCli`); output as table, csv, or json597- [create_direct_lake_model.py](./scripts/create_direct_lake_model.py) ; create a Direct Lake semantic model from lakehouse tables598- [export_semantic_model_as_pbip.py](./scripts/export_semantic_model_as_pbip.py) ; export a semantic model as a PBIP project (TMDL definition + blank report)599- [download_workspace.py](./scripts/download_workspace.py) ; download a full workspace with all item definitions and lakehouse files600601See [scripts/README.md](./scripts/README.md) for detailed usage, arguments, and examples. Always search the `scripts/` folder before writing a new helper; a script may already exist for the task.602603**External references** (request markdown when possible):604605- fab CLI: [GitHub Source](https://github.com/microsoft/fabric-cli) | [Docs](https://microsoft.github.io/fabric-cli/)606- Microsoft: [Fabric CLI Learn](https://learn.microsoft.com/en-us/rest/api/fabric/articles/fabric-command-line-interface)607- APIs: [Fabric API](https://learn.microsoft.com/en-us/rest/api/fabric/articles/) | [Power BI API](https://learn.microsoft.com/en-us/rest/api/power-bi/)608- DAX: [dax.guide](https://dax.guide/) - use `dax.guide/<function>/` e.g. `dax.guide/addcolumns/`609- Power Query: [powerquery.guide](https://powerquery.guide/) - use `powerquery.guide/function/<function>`610- [Power Query Best Practices](https://learn.microsoft.com/en-us/power-query/best-practices)