跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

fabric-cli

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".

data-goblin · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add data-goblin/power-bi-agentic-development --skill fabric-cli

技能说明


name: fabric-cli description: 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".

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
  • Keep fab current: check the installed version against the latest ms-fabric-cli release and upgrade with uv tool upgrade ms-fabric-cli unless the user has pinned a specific version. Discover commands and flags with fab --help and fab <command> --help rather than hard-coding behavior; the CLI surface changes regularly

[!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 (upgrade with uv tool upgrade ms-fabric-cli unless the user has pinned a 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

  1. Check the commands, syntax, and auth status: fab --help and fab auth status
  2. Check if the item exists if the user gave the workspace and item name: fab exists "spaceparts-dev.Workspace/spaceparts-otc-full.SemanticModel"
  3. Find an item by name across every workspace the user can see: fab find 'sales' -P type=Report -l (substring on name, description, workspace; -P type= to filter, -l for ids; -q '<jmespath>' for client-side filter/projection). For governance workflows that need last visit / last refresh / owner / storage mode / capacity SKU, use scripts/search_across_workspaces.py; see workspaces.md for the delta.
  4. Find the workspace: fab ls
  5. Find the item: fab ls "Workspace Name.Workspace"
  6. Check the commands for that item:
    • fab desc to get itemTypes
    • fab desc .<ItemType> for commands i.e. fab desc .SemanticModel
  7. 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"
    • Retrieve AI instructions / AI schema: python3 scripts/get_semantic_model_ai_metadata.py "ws.Workspace/Model.SemanticModel" --instructions-out instructions.md --schema-out schema.json
  8. 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"
  9. 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 SQL endpoint, warehouse, or SQL database (T-SQL): prefer the fabric-sql MCP execute_query(workspaceId, itemId, query) when it is loaded; fall back to python3 scripts/query_sql_endpoint.py "ws.Workspace/LH.Lakehouse" -q "SELECT TOP 10 * FROM dbo.orders". See querying-data.md
    • Lakehouse or warehouse Delta over OneLake (DuckDB): `python3 scripts/query_lakehouse_duckdb.py "ws.Wo
阅读完整来源 ↗