Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

powerbi-authoring-clipowerbi authoring CLI 搜索

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

226

周安装

25

GitHub Stars

306

下载量

173
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:powerbi-authoring-cli(powerbi authoring CLI 搜索)
来源仓库:https://github.com/microsoft/skills-for-fabric
仓库路径:skills/powerbi-authoring-cli
安装命令:
npx skills add https://github.com/microsoft/skills-for-fabric --skill powerbi-authoring-cli
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/microsoft/skills-for-fabric --skill powerbi-authoring-cli

简介

powerbi-authoring-cli 用于辅助安全审计与权限检查,适合在 Power BI 项目中识别凭据风险和认证漏洞。

  • 适用于梳理敏感配置、分析鉴权逻辑和生成安全复核清单。
  • 通过 npx skills add 命令从 GitHub 仓库安装并使用。
  • 不能将工具输出直接视为最终结论,涉及密钥或生产系统时需确认最小权限。
  • 建议结合项目上下文进行二次验证和操作脱敏。

SKILL.md

Update Check — ONCE PER SESSION (mandatory) The first time this skill is used in a session, run the check-updates skill before proceeding. - GitHub Copilot CLI / VS Code: invoke the check-updates skill. - Claude Code / Cowork / Cursor / Windsurf / Codex: compare local vs remote package.json version. - Skip if the check was already performed earlier in this session.
CRITICAL NOTES 1. To find the workspace details (including its ID) from workspace name: list all workspaces and, then, use JMESPath filtering 2. To find the item details (including its ID) from workspace ID, item type, and item name: list all items of that type in that workspace and, then, use JMESPath filtering

Power BI Semantic Model Authoring — CLI Skill

Table of Contents

TaskReferenceNotes
Finding Workspaces and Items in FabricCOMMON-CLI.md § Finding Workspaces and Items in FabricMandatory — *READ link first* [needed for finding workspace id by its name or item id by its name, item type, and workspace id]
Fabric Topology & Key ConceptsCOMMON-CORE.md § Fabric Topology & Key ConceptsHierarchy; Finding Things in Fabric
Environment URLsCOMMON-CORE.md § Environment URLsProduction (Public Cloud)
Tool Selection RationaleCOMMON-CLI.md § Tool Selection Rationale
Authentication RecipesCOMMON-CLI.md § Authentication Recipesaz login flows, environment detection, token acquisition, and debugging
Fabric Control-Plane API via az restCOMMON-CLI.md § Fabric Control-Plane API via az restAlways pass --resource; includes workspace/item operations, pagination, and LRO patterns
OneLake Data Access via curlCOMMON-CLI.md § OneLake Data Access via curlUse curl not az rest (different token audience)
Job Execution (CLI)COMMON-CLI.md § Job ExecutionRun notebooks/pipelines, refresh semantic models, check/cancel jobs
OneLake ShortcutsCOMMON-CLI.md § OneLake ShortcutsCreate a Shortcut; List Shortcuts; Delete a Shortcut
Capacity Management (CLI)COMMON-CLI.md § Capacity ManagementList Capacities; Assign Workspace to Capacity
Composite RecipesCOMMON-CLI.md § Composite RecipesEnd-to-end workspace→lakehouse→file, SQL endpoint→query, and notebook execution recipes
Gotchas & Troubleshooting (CLI-Specific)COMMON-CLI.md § Gotchas & Troubleshooting (CLI-Specific)az rest audience, shell escaping, token expiry
Quick ReferenceCOMMON-CLI.md § Quick Referenceaz rest Template; Token Audience ↔ CLI Tool Matrix
DAX Queries & Metadata Discoverypowerbi-consumption-cliRead-only DAX queries; use for post-creation validation
Tool StackSKILL.md § Tool Stackaz rest (primary), jq (JSON parsing), base64 encoding
Authentication & API AudiencesSKILL.md § Authentication & API AudiencesTwo audiences: Fabric API vs Power BI Datasets API
Must/Prefer/AvoidSKILL.md § Must/Prefer/AvoidGuardrails for semantic model authoring
SemanticModel Definition & EnvelopeITEM-DEFINITIONS-CORE.md § SemanticModelTMDL format; required parts, envelope structure, support matrix
TMDL File Structure & ExamplesSKILL.md § TMDL File StructureRequired parts, minimal content examples
TMDL CRUD (Create / Get / Update)SKILL.md § Create Semantic ModelCreateGet/DownloadUpdate; full lifecycle with LRO
Authoring Scope MatrixSKILL.md § Authoring Scope MatrixWhat Fabric API supports vs what to avoid
Refresh OperationsSKILL.md § Refresh OperationsTrigger, cancel, history, schedule (Power BI API)
Data Sources & ParametersSKILL.md § Data Sources & ParametersGet/update data sources and parameters
PermissionsSKILL.md § PermissionsGrant/update dataset user permissions
Deployment PipelinesSKILL.md § Deployment PipelinesList, get stages, deploy between stages
Agentic WorkflowSKILL.md § Agentic WorkflowStep-by-step: discover → create → verify → refresh → validate
TroubleshootingSKILL.md § TroubleshootingCommon errors table: LRO, auth, TMDL encoding, refresh
ExamplesSKILL.md § ExamplesCreate model, download definition, refresh, deploy
Property-to-API Mappingsemantic-model-properties-guide.md § Property-to-API MappingMaps each property category to the correct API surface
Owner, Storage Mode & Operational Metadatasemantic-model-properties-guide.md § Owner, Storage ModePower BI Datasets API properties
Refresh History Response Propertiessemantic-model-properties-guide.md § Refresh HistoryRefresh detail response fields
Data Source Response Propertiessemantic-model-properties-guide.md § Data SourcesConnection and gateway properties
DirectQuery / LiveConnection Refresh Schedulesemantic-model-properties-guide.md § DQ Refresh ScheduleDirectQuery/LiveConnection schedule settings
Upstream Dataflow Linkssemantic-model-properties-guide.md § Upstream DataflowsDataflow dependency properties
Per-Table Storage Modesemantic-model-properties-guide.md § Per-Table StorageTable-level storage mode via TMDL
TMDL Syntax Rulestmdl-authoring-guide.md § TMDL Syntax RulesTab indentation, object declaration, quoting rules
Modeling Best Practicestmdl-authoring-guide.md § Modeling Best PracticesNaming conventions, column rules, measure & DAX rules, format strings
Relationshipstmdl-authoring-guide.md § RelationshipsRelationship declarations, key rules
Hierarchiestmdl-authoring-guide.md § HierarchiesHierarchy declarations and key rules
Direct Lake Guidelinestmdl-authoring-guide.md § Direct Lake GuidelinesDirect Lake mode configuration and constraints
Calculated Tablestmdl-authoring-guide.md § Calculated TablesDAX-based calculated table definitions
Date/Calendar Tabletmdl-authoring-guide.md § Date/Calendar TableCalendar table setup and marking
Parameterstmdl-authoring-guide.md § ParametersExpression-based parameter declarations
Annotationstmdl-authoring-guide.md § AnnotationsModel and object-level annotations
TMDL File Layout & Core Filestmdl-advanced-features-guide.md § File LayoutDirectory structure, database.tmdl, model.tmdl
Calculation Groupstmdl-advanced-features-guide.md § Calculation GroupsCalculation group tables and items
Security Rolestmdl-advanced-features-guide.md § Security RolesRLS/OLS role definitions
Security Role MembershipsSKILL.md § Security Role MembershipsAdd/list/delete users & groups in RLS roles (Power BI API)
Translations / Culturestmdl-advanced-features-guide.md § Translations / CulturesLocalization via culture files
Perspectivestmdl-advanced-features-guide.md § PerspectivesPerspective definitions for subset views
Functionstmdl-advanced-features-guide.md § FunctionsUser-defined DAX functions in the model
Calendar Objectstmdl-advanced-features-guide.md § Calendar ObjectsAuto date/time calendar table objects

Tool Stack

ToolRoleInstall
az CLIPrimary: az rest for Fabric and Power BI REST API calls, az login for auth.Pre-installed in most dev environments
jqParse JSON from az rest responsesPre-installed or trivial
base64 (Linux/macOS) / [Convert]::ToBase64String (PowerShell)Encode TMDL file content for definition payloadsBuilt-in
Agent check — verify before first operation: ``bash az version 2>/dev/null || echo "INSTALL: https://learn.microsoft.com/cli/azure/install-azure-cli" ``

Authentication & API Audiences

This skill uses two distinct API audiences. Using the wrong audience returns a 401.

APIAudience (--resource)Use For
Fabric Items APIhttps://api.fabric.microsoft.comCreate/get/update/delete semantic model definitions, list items, LRO polling
Power BI Datasets APIhttps://analysis.windows.net/powerbi/apiRefresh, data sources, parameters, permissions, deployment pipelines
# Fabric Items API — semantic model definition operations
az rest --method post \
  --resource "https://api.fabric.microsoft.com" \
  --url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels" \
  ...

# Power BI Datasets API — refresh, data sources, permissions
az rest --method post \
  --resource "https://analysis.windows.net/powerbi/api" \
  --url "https://api.powerbi.com/v1.0/myorg/groups/$WS_ID/datasets/$DATASET_ID/refreshes" \
  ...

Must/Prefer/Avoid

MUST DO

  • Read the relevant TMDL reference sections BEFORE generating any TMDL — at minimum read TMDL Syntax Rules and Modeling Best Practices. If the task involves relationships, hierarchies, calculation groups, security roles, or translations, also read the corresponding sections in tmdl-authoring-guide.md and tmdl-advanced-features-guide.md. Do not generate TMDL from memory.
  • Always pass --resource to az rest — omitting it causes silent auth failures. Use the correct audience per the table above.
  • Always pass --headers "Content-Type=application/json" on POST/PATCH/PUT calls with a --body to the Power BI Datasets API — omitting it causes Unsupported Media Type errors.
  • Include ALL definition parts in updateDefinition — modified + unmodified. The API replaces the entire definition; omitting parts deletes them.
  • Never include .platform in updateDefinition payloads — it is Git integration metadata and causes errors.
  • Poll LRO to completioncreateItemWithDefinition, getDefinition, and updateDefinition return 202 Accepted with an Operation-Id header. Poll until terminal state.
  • Base64-encode TMDL content — all payload values in definition parts must be base64-encoded.
  • Single-quote names with special chars — names containing spaces, ., =, :, or ' must be wrapped in single quotes in TMDL.
  • Verify workspace has capacity before creating a semantic model — call GET /v1/workspaces/{id} and check capacityId.

PREFER

  • createItemWithDefinition (single POST) over create-then-update for new semantic models.
  • TMDL format over TMSL — TMDL is text-based, diff-friendly, and the preferred format for Fabric.
  • Measures before columns in TMDL table files — follows TMDL convention.
  • Multi-line DAX in triple backticks — improves readability for complex expressions.
  • Route fine-grained changes to powerbi-modeling-mcp — for adding/modifying individual measures, columns, or relationships, the MCP server is more efficient than full definition round-trips.
  • Get definition before updating — always retrieve the current definition, modify, then POST back to avoid overwriting concurrent changes.
  • Cross-reference powerbi-consumption-cli for post-creation validation — run DAX queries to verify measures, relationships, and data.

AVOID

  • updateDefinition for small changes — a full definition round-trip is heavy; route to powerbi-modeling-mcp for individual object edits.
  • Report creation — not supported by this skill. Reports require a separate definition format (PBIR/PBIR-Legacy).
  • lineageTag on new objects — TMDL auto-generates lineage tags; adding them manually causes conflicts.
  • // comments in TMDL — not supported. Use /// descriptions instead.
  • description property in TMDL — use /// syntax above the object instead.
  • Hardcoded workspace/item IDs — resolve dynamically via REST API (see COMMON-CLI.md § Finding Workspaces and Items in Fabric).
  • Sending only modified parts in updateDefinition — the API replaces the full definition; missing parts are deleted.

TMDL File Structure

For the full definition envelope and part paths, see ITEM-DEFINITIONS-CORE.md § SemanticModel.

Required TMDL parts for createItemWithDefinition and updateDefinition:

Part PathContentRequired
definition.pbismSemantic model connection settingsYes
definition/database.tmdlDatabase properties (compatibility level)Yes
definition/model.tmdlModel properties (culture, default summarization)Yes
definition/tables/<TableName>.tmdlPer-table: columns, measures, partitionsYes (≥1)
Critical: updateDefinition must include ALL parts — modified and unmodified. The API replaces the entire definition. Never include .platform in update payloads.

For TMDL syntax rules, naming conventions, and modeling best practices, see tmdl-authoring-guide.md.


Minimal TMDL Content Examples

definition.pbism

{
    "version": "4.2",
    "settings": {
        "qnaEnabled": true
    }
}

database.tmdl

database
	compatibilityLevel: 1702
	compatibilityMode: powerBI

model.tmdl

model Model
	culture: en-US
	defaultPowerBIDataSourceVersion: powerBI_V3
	discourageImplicitMeasures
Note: defaultPowerBIDataSourceVersion: powerBI_V3 is required for Import-mode models. Without it, the API returns Import from JSON supported for V3 models only.

Import-Mode Table

table Customer

	/// Total number of customers
	measure '# Customers' = COUNTROWS(Customer)
		formatString: #,##0

	column CustomerId
		dataType: int64
		isHidden
		isKey
		summarizeBy: none
		sourceColumn: CustomerId

	column 'Customer Name'
		dataType: string
		sourceColumn: CustomerName

	partition Customer = m
		mode: import
		source =
			let
				Source = Sql.Database(#"Server", #"Database"),
				Customer = Source{[Schema="dbo", Item="Customer"]}[Data]
			in
				Customer

Direct Lake Table

expression DL_Lakehouse =
	let
		Source = AzureStorage.DataLake("https://onelake.dfs.fabric.microsoft.com/<WorkspaceId>/<LakehouseId>", [HierarchicalNavigation=true])
	in
		Source

table Sales

	/// Total revenue
	measure 'Total Sales' = ```
			SUMX(
				Sales,
				Sales[Quantity] * Sales[UnitPrice]
			)

formatString: \$#,##0.00

column SalesKey dataType: int64 isHidden isKey summarizeBy: none sourceColumn: sales_key

column Quantity dataType: int64 sourceColumn: quantity

column UnitPrice dataType: decimal summarizeBy: none sourceColumn: unit_price

partition Sales = entity mode: directLake source entityName: Sales schemaName: dbo expressionSource: DL_Lakehouse


---

## Create Semantic Model

Full lifecycle: author TMDL → base64-encode → construct payload → POST → poll LRO.

Per [COMMON-CLI.md § Item CRUD Operations](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/../../common/COMMON-CLI.md#item-crud-operations) and [ITEM-DEFINITIONS-CORE.md § Definition Envelope](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/../../common/ITEM-DEFINITIONS-CORE.md#definition-envelope):

WS_ID="<workspaceId>"

1. Base64-encode each TMDL file

PBISM=$(base64 -w 0 < definition.pbism) DB=$(base64 -w 0 < definition/database.tmdl) MODEL=$(base64 -w 0 < definition/model.tmdl) TABLE=$(base64 -w 0 < definition/tables/Customer.tmdl)

2. Construct payload and create — use --verbose to capture HTTP status and LRO headers

cat > /tmp/body.json << EOF { "displayName": "MySalesModel", "definition": { "format": "TMDL", "parts": [ {"path": "definition.pbism", "payload": "$PBISM", "payloadType": "InlineBase64"}, {"path": "definition/database.tmdl", "payload": "$DB", "payloadType": "InlineBase64"}, {"path": "definition/model.tmdl", "payload": "$MODEL", "payloadType": "InlineBase64"}, {"path": "definition/tables/Customer.tmdl", "payload": "$TABLE", "payloadType": "InlineBase64"} ] } } EOF az rest --method post --verbose \ --resource "https://api.fabric.microsoft.com" \ --url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json


> **PowerShell** — use `[Convert]::ToBase64String([System.IO.File]::ReadAllBytes("file"))` instead of `base64 -w 0`.

If the response is `202 Accepted`, poll using the LRO pattern from [COMMON-CLI.md § Long-Running Operations](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/../../common/COMMON-CLI.md#long-running-operations-lro-pattern).

---

## Get/Download Definition

Retrieve TMDL definition for backup, migration, or inspection. `getDefinition` is a **POST** (not GET).

WS_ID="<workspaceId>" MODEL_ID="<semanticModelId>"

1. Request definition — may return 200 (inline) or 202 (LRO)

RESPONSE=$(az rest --method post --verbose \ --resource "https://api.fabric.microsoft.com" \ --url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels/$MODEL_ID/getDefinition?format=TMDL" \ --body '{}' \ --output json 2>/dev/null)

2. If 202, poll the Location header URL until Succeeded, then GET /result

3. Decode each part

echo "$RESPONSE" | jq -r '.definition.parts[] | .path + " " + .payload' | \ while read -r path payload; do mkdir -p "$(dirname "$path")" echo "$payload" | base64 -d > "$path" done


---

## Update Definition

> **Critical rules**: Must include ALL parts (modified + unmodified). Never include `.platform`. The API replaces the entire definition — omitted parts are deleted.

WS_ID="<workspaceId>" MODEL_ID="<semanticModelId>"

1. Get current definition (see Get/Download Definition above)

2. Modify the relevant TMDL files

3. Re-encode ALL parts and POST

cat > /tmp/body.json << EOF { "definition": { "format": "TMDL", "parts": [ {"path": "definition.pbism", "payload": "$PBISM", "payloadType": "InlineBase64"}, {"path": "definition/database.tmdl", "payload": "$DB", "payloadType": "InlineBase64"}, {"path": "definition/model.tmdl", "payload": "$MODEL", "payloadType": "InlineBase64"}, {"path": "definition/tables/Customer.tmdl", "payload": "$TABLE", "payloadType": "InlineBase64"} ] } } EOF az rest --method post \ --resource "https://api.fabric.microsoft.com" \ --url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels/$MODEL_ID/updateDefinition" \ --body @/tmp/body.json


Use `?updateMetadata=true` query parameter only when the `.platform` file must be included to update display name or description via definition.

---

## Authoring Scope Matrix

| Operation | Supported | Method |
| --- | --- | --- |
| Create semantic model with TMDL | ✅ | `POST /v1/workspaces/{id}/semanticModels` with definition |
| Get/download TMDL definition | ✅ | `POST.../semanticModels/{id}/getDefinition?format=TMDL` |
| Update full TMDL definition | ✅ | `POST.../semanticModels/{id}/updateDefinition` |
| Delete semantic model | ✅ | `DELETE /v1/workspaces/{id}/semanticModels/{id}` |
| Refresh dataset | ✅ | Power BI Datasets API (Phase 4) |
| Add/modify single measure or column | ⚠️ Route to `powerbi-modeling-mcp` | Full definition round-trip is inefficient |
| Create reports | ❌ | Not in scope — separate definition format (PBIR) |

---

## Refresh Operations

All refresh operations use the **Power BI Datasets API** audience (`https://analysis.windows.net/powerbi/api`).

WS_ID="<workspaceId>" DATASET_ID="<semanticModelId>" PBI="https://api.powerbi.com/v1.0/myorg"

Trigger full refresh

cat > /tmp/body.json << 'EOF' {"notifyOption": "NoNotification"} EOF az rest --method post --verbose \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json

Get refresh history (latest first)

az rest --method get \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes?\$top=5"

Cancel an in-progress refresh

az rest --method delete \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes/<refreshId>"

Get refresh schedule

az rest --method get \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshSchedule"

Update refresh schedule

cat > /tmp/body.json << 'EOF' { "value": { "enabled": true, "days": ["Monday", "Wednesday", "Friday"], "times": ["02:00", "14:00"], "localTimeZoneId": "UTC" } } EOF az rest --method patch \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshSchedule" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json


---

## Data Sources & Parameters

Get data sources for a dataset

az rest --method get \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/datasources"

Get parameters

az rest --method get \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/parameters"

Update parameters

cat > /tmp/body.json << 'EOF' { "updateDetails": [ {"name": "Server", "newValue": "newserver.database.windows.net"}, {"name": "Database", "newValue": "ProductionDB"} ] } EOF az rest --method post \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/Default.UpdateParameters" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json


> After updating parameters or data source credentials, trigger a refresh for changes to take effect.

---

## Permissions

List dataset users

az rest --method get \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users"

Grant dataset permissions to a user

cat > /tmp/body.json << 'EOF' { "identifier": "user@contoso.com", "principalType": "User", "datasetUserAccessRight": "Read" } EOF az rest --method post \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json

Update existing user permissions

cat > /tmp/body.json << 'EOF' { "identifier": "user@contoso.com", "principalType": "User", "datasetUserAccessRight": "ReadReshare" } EOF az rest --method put \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json


Permission levels: `Read`, `ReadReshare`, `ReadExplore`, `ReadReshareExplore`.

---

## Security Role Memberships

After defining RLS/OLS roles in TMDL (see [Security Roles](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/./references/tmdl-advanced-features-guide.md#security-roles)), use the **Power BI Datasets API** to assign users and groups to those roles.

PBI="https://api.powerbi.com/v1.0/myorg"

List members of a security role

az rest --method get \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users" \ | jq '[.value[] | select(.datasetUserAccessRight == "Read" and .roles != null)]'

Add a user to a security role

cat > /tmp/body.json << 'EOF' { "identifier": "user@contoso.com", "principalType": "User", "datasetUserAccessRight": "Read", "roles": ["SalesRegion"] } EOF az rest --method post \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json

Add a security group to a role

cat > /tmp/body.json << 'EOF' { "identifier": "<group-object-id>", "principalType": "Group", "datasetUserAccessRight": "Read", "roles": ["SalesRegion"] } EOF az rest --method post \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json

Update role membership (e.g., move user to a different role)

cat > /tmp/body.json << 'EOF' { "identifier": "user@contoso.com", "principalType": "User", "datasetUserAccessRight": "Read", "roles": ["EuropeOnly"] } EOF az rest --method put \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json


> The `roles` array accepts one or more role names that must match roles defined in the semantic model's TMDL. The user/group must also have at least `Read` permission on the dataset. `principalType` can be `User`, `Group`, or `App`.

---

## Deployment Pipelines

Deployment pipelines use the **Fabric API** audience (`https://api.fabric.microsoft.com`).

FABRIC="https://api.fabric.microsoft.com/v1"

List deployment pipelines

az rest --method get \ --resource "https://api.fabric.microsoft.com" \ --url "$FABRIC/deploymentPipelines"

Get pipeline stages

az rest --method get \ --resource "https://api.fabric.microsoft.com" \ --url "$FABRIC/deploymentPipelines/<pipelineId>/stages"

Deploy from one stage to the next (e.g., Dev → Test)

cat > /tmp/body.json << 'EOF' { "sourceStageOrder": 0, "targetStageOrder": 1, "items": [ { "sourceItemId": "<semanticModelId>", "itemType": "SemanticModel" } ], "options": { "allowCreateArtifact": true, "allowOverwriteArtifact": true } } EOF az rest --method post \ --resource "https://api.fabric.microsoft.com" \ --url "$FABRIC/deploymentPipelines/<pipelineId>/deploy" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json


> Omit the `items` array to deploy all items in the stage. The deploy call returns `202 Accepted` — poll using the [LRO pattern](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/../../common/COMMON-CLI.md#long-running-operations-lro-pattern).

---

## Agentic Workflow

### Tool Selection Priority

1. **`powerbi-modeling-mcp` available** → use MCP tools for fine-grained object changes (measures, columns, relationships)
2. **MCP unavailable, TMDL files available** → edit TMDL files directly, deploy via `az rest` updateDefinition
3. **MCP unavailable, workspace only** → use this skill: getDefinition → edit TMDL → updateDefinition

### Workflow Steps

1. **Discover workspace** → list workspaces, find target by name (see [COMMON-CLI.md § Finding Workspaces and Items](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/../../common/COMMON-CLI.md#finding-workspaces-and-items-in-fabric))
2. **List semantic models** → `GET /v1/workspaces/{id}/semanticModels` to find existing models or confirm name availability
3. **Analyze source schema** → inspect source tables/columns via SQL, DAX, or Lakehouse metadata to inform star schema design
4. **Design star schema** → identify fact and dimension tables, define relationship keys, plan measures
5. **Author TMDL files** → create `definition.pbism`, `database.tmdl`, `model.tmdl`, and table files per [Minimal TMDL Content Examples](#minimal-tmdl-content-examples) and [tmdl-authoring-guide.md](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/./references/tmdl-authoring-guide.md)
6. **Create relationships** → define in table TMDL files **before** creating measures that depend on them
7. **Create measures** → add explicit measures with `formatString` for all aggregatable values
8. **Deploy** → base64-encode all parts → POST createItemWithDefinition (see [Create Semantic Model](#create-semantic-model))
9. **Verify** → run validation checks (see below)
10. **Refresh** → trigger dataset refresh via [Refresh Operations](#refresh-operations)
11. **Validate with DAX** → use [powerbi-consumption-cli](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/../powerbi-consumption-cli/SKILL.md) to run DAX queries against the deployed model

### Post-Creation Validation

- **TMDL structure** — verify all required parts are present (definition.pbism, database.tmdl, model.tmdl, ≥1 table)
- **Test measures** — run `EVALUATE {[Measure Name]}` for each measure via DAX
- **Verify relationships** — confirm cardinality, cross-filter direction, matching `dataType` on both sides
- **Verify columns** — confirm `sourceColumn` mappings and `dataType` match source schema
- **Check for duplicates** — no duplicate measure names or orphan objects

---

## Troubleshooting

> **Early-abort rule**: If **both** `getDefinition` returns `404 EntityNotFound` (on an item you can list/GET) **and** the Power BI refresh API returns `403 Forbidden` with `"identity None"`, **stop retrying immediately** — the user almost certainly has only Viewer role on the workspace. Verify by calling `GET /v1/workspaces/{id}/roleAssignments`; if that also returns `403 InsufficientWorkspaceRole`, confirm to the user they need Contributor or higher role. Do **not** retry with different URL formats, endpoints, or parameters — the issue is permissions, not API usage.

| Symptom | Cause | Fix |
| --- | --- | --- |
| `403 Forbidden` with `"identity None"` on Power BI API | User has Viewer role — refresh, data sources, and permissions APIs require Contributor+ | **Stop immediately.** Ask user to request Contributor/Member/Admin role on the workspace |
| `404 EntityNotFound` on getDefinition but item exists in list | Insufficient permissions masquerading as 404 — getDefinition requires Contributor+ | Check workspace role first; do not retry with different URL formats |
| `403 InsufficientWorkspaceRole` on roleAssignments | User is Viewer on the workspace | Confirms Viewer role — all authoring and most read operations are blocked |
| `401 Unauthorized` on Fabric API | Wrong or missing `--resource` | Use `--resource "https://api.fabric.microsoft.com"` |
| `401 Unauthorized` on Power BI API | Wrong audience | Use `--resource "https://analysis.windows.net/powerbi/api"` |
| `411 Length Required` on getDefinition | Missing request body | Pass `--body '{}'` — getDefinition is a POST |
| LRO poll never completes | Token expired during long operation | Re-acquire token in poll loop; increase Retry-After interval |
| `202 Accepted` but no result | Didn't follow LRO to completion | Poll `Location` header URL until `Succeeded`, then GET `/result` |
| TMDL validation error on create/update | Syntax error in TMDL content | Check TMDL rules in [tmdl-authoring-guide.md](https://github.com/microsoft/skills-for-fabric/blob/HEAD/skills/powerbi-authoring-cli/./references/tmdl-authoring-guide.md); validate before encoding |
| Parts missing after updateDefinition | Only modified parts were sent | Must include ALL parts (modified + unmodified) in every update |
| Error including `.platform` in update | `.platform` not accepted by default | Remove `.platform` from parts, or use `?updateMetadata=true` |
| Base64 decode produces garbled content | Wrong encoding or line wrapping | Use `base64 -w 0` (no line wrap) or `[Convert]::ToBase64String()` |
| Refresh fails with data source error | Credentials expired or parameters wrong | Check data sources and parameters; update credentials if needed |
| Deployment pipeline fails | Workspace not assigned to stage | Assign workspace to pipeline stage before deploying |
| `lineageTag` conflict on new objects | Manually added `lineageTag` | Remove `lineageTag` from new objects — it is auto-generated |
| DAX error testing measures | Measure name case mismatch | DAX measure names are case-sensitive; match exactly |
| Attempting `INFO.ROLES()` / `INFO.ROLEMEMBERSHIPS()` via DAX to retrieve role members | DAX `INFO` functions do not reliably return role membership data and may return empty or incomplete results | Use the **Power BI REST API** instead: `GET /v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/users` and filter by `roles` field (see [Security Role Memberships](#security-role-memberships)) |

---

## Examples

### Create a Semantic Model from TMDL

WS_ID="<workspaceId>"

Encode all TMDL files

PBISM=$(base64 -w 0 < definition.pbism) DB=$(base64 -w 0 < definition/database.tmdl) MODEL=$(base64 -w 0 < definition/model.tmdl) CUSTOMER=$(base64 -w 0 < definition/tables/Customer.tmdl) SALES=$(base64 -w 0 < definition/tables/Sales.tmdl)

cat > /tmp/body.json << EOF { "displayName": "SalesModel", "definition": { "parts": [ {"path": "definition.pbism", "payload": "$PBISM", "payloadType": "InlineBase64"}, {"path": "definition/database.tmdl", "payload": "$DB", "payloadType": "InlineBase64"}, {"path": "definition/model.tmdl", "payload": "$MODEL", "payloadType": "InlineBase64"}, {"path": "definition/tables/Customer.tmdl", "payload": "$CUSTOMER", "payloadType": "InlineBase64"}, {"path": "definition/tables/Sales.tmdl", "payload": "$SALES", "payloadType": "InlineBase64"} ] } } EOF az rest --method post --verbose \ --resource "https://api.fabric.microsoft.com" \ --url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels" \ --headers "Content-Type=application/json" \ --body @/tmp/body.json


### Download a Semantic Model Definition

WS_ID="<workspaceId>" MODEL_ID="<semanticModelId>"

Get definition (may return 202 — follow LRO)

RESULT=$(az rest --method post \ --resource "https://api.fabric.microsoft.com" \ --url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels/$MODEL_ID/getDefinition?format=TMDL" \ --body '{}' --output json)

Decode and save all parts

echo "$RESULT" | jq -r '.definition.parts[] | .path + "\t" + .payload' | \ while IFS=$'\t' read -r path payload; do mkdir -p "$(dirname "$path")" echo "$payload" | base64 -d > "$path" echo "Saved: $path" done


### Trigger a Refresh and Check Status

WS_ID="<workspaceId>" DATASET_ID="<semanticModelId>" PBI="https://api.powerbi.com/v1.0/myorg"

Trigger refresh

cat > /tmp/body.json << 'EOF' {"type": "Full"} EOF az rest --method post \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes" \ --body @/tmp/body.json

Check latest refresh status

az rest --method get \ --resource "https://analysis.windows.net/powerbi/api" \ --url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes?\$top=1"


### Deploy to Production via Pipeline

FABRIC="https://api.fabric.microsoft.com/v1" PIPELINE_ID="<pipelineId>"

Deploy from Test (stage 1) to Production (stage 2)

cat > /tmp/body.json << 'EOF' { "sourceStageOrder": 1, "targetStageOrder": 2, "items": [ {"sourceItemId": "<semanticModelId>", "itemType": "SemanticModel"} ], "options": { "allowCreateArtifact": true, "allowOverwriteArtifact": true } } EOF az rest --method post \ --resource "https://api.fabric.microsoft.com" \ --url "$FABRIC/deploymentPipelines/$PIPELINE_ID/deploy" \ --body @/tmp/body.json

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.83%
按下载量换算60

Claude

29.3%
按下载量换算51

Cursor

20.04%
按下载量换算35

Gemini CLI

8.45%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/microsoft/skills-for-fabric --skill powerbi-authoring-cli 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills