powerbi-authoring-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUpdate 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
skill.check-updates- 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
- To find the workspace details (including its ID) from workspace name: list all workspaces and, then, use JMESPath filtering
- 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
更新检查 — 每会话一次(必填) 在会话中首次使用此技能前,请先运行check-updates技能。
- GitHub Copilot CLI / VS Code:调用
技能。check-updates- Claude Code / Cowork / Cursor / Windsurf / Codex:比较本地与远程package.json版本。
- 若会话早期已执行过该检查,可跳过。
重要说明
- 从工作区名称查找工作区详情(包括其ID):列出所有工作区,然后使用JMESPath筛选
- 从工作区ID、项类型和项名称查找项详情(包括其ID):列出该工作区中该类型的所有项,然后使用JMESPath筛选
Power BI Semantic Model Authoring — CLI Skill
Power BI语义模型创作 — CLI技能
Table of Contents
目录
| Task | Reference | Notes |
|---|---|---|
| Finding Workspaces and Items in Fabric | COMMON-CLI.md § Finding Workspaces and Items in Fabric | Mandatory — 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 Concepts | COMMON-CORE.md § Fabric Topology & Key Concepts | Hierarchy; Finding Things in Fabric |
| Environment URLs | COMMON-CORE.md § Environment URLs | Production (Public Cloud) |
| Tool Selection Rationale | COMMON-CLI.md § Tool Selection Rationale | |
| Authentication Recipes | COMMON-CLI.md § Authentication Recipes | |
Fabric Control-Plane API via | COMMON-CLI.md § Fabric Control-Plane API via | Always pass |
OneLake Data Access via | COMMON-CLI.md § OneLake Data Access via | Use |
| Job Execution (CLI) | COMMON-CLI.md § Job Execution | Run notebooks/pipelines, refresh semantic models, check/cancel jobs |
| OneLake Shortcuts | COMMON-CLI.md § OneLake Shortcuts | Create a Shortcut; List Shortcuts; Delete a Shortcut |
| Capacity Management (CLI) | COMMON-CLI.md § Capacity Management | List Capacities; Assign Workspace to Capacity |
| Composite Recipes | COMMON-CLI.md § Composite Recipes | End-to-end workspace→lakehouse→file, SQL endpoint→query, and notebook execution recipes |
| Gotchas & Troubleshooting (CLI-Specific) | COMMON-CLI.md § Gotchas & Troubleshooting (CLI-Specific) | |
| Quick Reference | COMMON-CLI.md § Quick Reference | |
| DAX Queries & Metadata Discovery | powerbi-consumption-cli | Read-only DAX queries; use for post-creation validation |
| Tool Stack | SKILL.md § Tool Stack | |
| Authentication & API Audiences | SKILL.md § Authentication & API Audiences | Two audiences: Fabric API vs Power BI Datasets API |
| Must/Prefer/Avoid | SKILL.md § Must/Prefer/Avoid | Guardrails for semantic model authoring |
| SemanticModel Definition & Envelope | ITEM-DEFINITIONS-CORE.md § SemanticModel | TMDL format; required parts, envelope structure, support matrix |
| TMDL File Structure & Examples | SKILL.md § TMDL File Structure | Required parts, minimal content examples |
| TMDL CRUD (Create / Get / Update) | SKILL.md § Create Semantic Model | Create → Get/Download → Update; full lifecycle with LRO |
| Authoring Scope Matrix | SKILL.md § Authoring Scope Matrix | What Fabric API supports vs what to avoid |
| Refresh Operations | SKILL.md § Refresh Operations | Trigger, cancel, history, schedule (Power BI API) |
| Data Sources & Parameters | SKILL.md § Data Sources & Parameters | Get/update data sources and parameters |
| Permissions | SKILL.md § Permissions | Grant/update dataset user permissions |
| Deployment Pipelines | SKILL.md § Deployment Pipelines | List, get stages, deploy between stages |
| Agentic Workflow | SKILL.md § Agentic Workflow | Step-by-step: discover → create → verify → refresh → validate |
| Troubleshooting | SKILL.md § Troubleshooting | Common errors table: LRO, auth, TMDL encoding, refresh |
| Examples | SKILL.md § Examples | Create model, download definition, refresh, deploy |
| Property-to-API Mapping | semantic-model-properties-guide.md § Property-to-API Mapping | Maps each property category to the correct API surface |
| Owner, Storage Mode & Operational Metadata | semantic-model-properties-guide.md § Owner, Storage Mode | Power BI Datasets API properties |
| Refresh History Response Properties | semantic-model-properties-guide.md § Refresh History | Refresh detail response fields |
| Data Source Response Properties | semantic-model-properties-guide.md § Data Sources | Connection and gateway properties |
| DirectQuery / LiveConnection Refresh Schedule | semantic-model-properties-guide.md § DQ Refresh Schedule | DirectQuery/LiveConnection schedule settings |
| Upstream Dataflow Links | semantic-model-properties-guide.md § Upstream Dataflows | Dataflow dependency properties |
| Per-Table Storage Mode | semantic-model-properties-guide.md § Per-Table Storage | Table-level storage mode via TMDL |
| TMDL Syntax Rules | tmdl-authoring-guide.md § TMDL Syntax Rules | Tab indentation, object declaration, quoting rules |
| Modeling Best Practices | tmdl-authoring-guide.md § Modeling Best Practices | Naming conventions, column rules, measure & DAX rules, format strings |
| Relationships | tmdl-authoring-guide.md § Relationships | Relationship declarations, key rules |
| Hierarchies | tmdl-authoring-guide.md § Hierarchies | Hierarchy declarations and key rules |
| Direct Lake Guidelines | tmdl-authoring-guide.md § Direct Lake Guidelines | Direct Lake mode configuration and constraints |
| Calculated Tables | tmdl-authoring-guide.md § Calculated Tables | DAX-based calculated table definitions |
| Date/Calendar Table | tmdl-authoring-guide.md § Date/Calendar Table | Calendar table setup and marking |
| Parameters | tmdl-authoring-guide.md § Parameters | Expression-based parameter declarations |
| Annotations | tmdl-authoring-guide.md § Annotations | Model and object-level annotations |
| TMDL File Layout & Core Files | tmdl-advanced-features-guide.md § File Layout | Directory structure, database.tmdl, model.tmdl |
| Calculation Groups | tmdl-advanced-features-guide.md § Calculation Groups | Calculation group tables and items |
| Security Roles | tmdl-advanced-features-guide.md § Security Roles | RLS/OLS role definitions |
| Security Role Memberships | SKILL.md § Security Role Memberships | Add/list/delete users & groups in RLS roles (Power BI API) |
| Translations / Cultures | tmdl-advanced-features-guide.md § Translations / Cultures | Localization via culture files |
| Perspectives | tmdl-advanced-features-guide.md § Perspectives | Perspective definitions for subset views |
| Functions | tmdl-advanced-features-guide.md § Functions | User-defined DAX functions in the model |
| Calendar Objects | tmdl-advanced-features-guide.md § Calendar Objects | Auto date/time calendar table objects |
| 任务 | 参考文档 | 说明 |
|---|---|---|
| 在Fabric中查找工作区和项 | COMMON-CLI.md § 在Fabric中查找工作区和项 | 必填 — 先阅读链接内容[需要通过工作区名称查找工作区ID,或通过项名称、项类型和工作区ID查找项ID] |
| Fabric拓扑与核心概念 | COMMON-CORE.md § Fabric拓扑与核心概念 | 层级结构;在Fabric中查找资源 |
| 环境URL | COMMON-CORE.md § 环境URL | 生产环境(公有云) |
| 工具选择依据 | COMMON-CLI.md § 工具选择依据 | |
| 身份验证方案 | COMMON-CLI.md § 身份验证方案 | |
通过 | COMMON-CLI.md § 通过 | 必须传递 |
通过 | COMMON-CLI.md § 通过 | 使用 |
| 作业执行(CLI) | COMMON-CLI.md § 作业执行 | 运行笔记本/流水线、刷新语义模型、检查/取消作业 |
| OneLake快捷方式 | COMMON-CLI.md § OneLake快捷方式 | 创建快捷方式;列出快捷方式;删除快捷方式 |
| 容量管理(CLI) | COMMON-CLI.md § 容量管理 | 列出容量;为工作区分配容量 |
| 复合方案 | COMMON-CLI.md § 复合方案 | 从工作区到湖仓再到文件、SQL端点查询、笔记本执行的端到端方案 |
| 常见问题与故障排除(CLI专属) | COMMON-CLI.md § 常见问题与故障排除(CLI专属) | |
| 快速参考 | COMMON-CLI.md § 快速参考 | |
| DAX查询与元数据发现 | powerbi-consumption-cli | 只读DAX查询;用于创建后的验证 |
| 工具栈 | SKILL.md § 工具栈 | |
| 身份验证与API受众 | SKILL.md § 身份验证与API受众 | 两个受众:Fabric API与Power BI Datasets API |
| 必须/推荐/避免 | SKILL.md § 必须/推荐/避免 | 语义模型创作的约束规则 |
| 语义模型定义与信封结构 | ITEM-DEFINITIONS-CORE.md § 语义模型 | TMDL格式;必填部分、信封结构、支持矩阵 |
| TMDL文件结构与示例 | SKILL.md § TMDL文件结构 | 必填部分、最小内容示例 |
| TMDL增删改查(创建/获取/更新) | SKILL.md § 创建语义模型 | 创建 → 获取/下载 → 更新;包含LRO的完整生命周期 |
| 创作范围矩阵 | SKILL.md § 创作范围矩阵 | Fabric API支持的操作与需避免的操作 |
| 刷新操作 | SKILL.md § 刷新操作 | 触发、取消、历史记录、调度(Power BI API) |
| 数据源与参数 | SKILL.md § 数据源与参数 | 获取/更新数据源和参数 |
| 权限 | SKILL.md § 权限 | 授予/更新数据集用户权限 |
| 部署流水线 | SKILL.md § 部署流水线 | 列出流水线、获取阶段、在阶段间部署 |
| 智能工作流 | SKILL.md § 智能工作流 | 分步流程:发现 → 创建 → 验证 → 刷新 → 校验 |
| 故障排除 | SKILL.md § 故障排除 | 常见错误表:LRO、身份验证、TMDL编码、刷新 |
| 示例 | SKILL.md § 示例 | 创建模型、下载定义、刷新、部署 |
| 属性到API的映射 | semantic-model-properties-guide.md § 属性到API的映射 | 将每个属性类别映射到正确的API层面 |
| 所有者、存储模式与操作元数据 | semantic-model-properties-guide.md § 所有者、存储模式 | Power BI Datasets API属性 |
| 刷新历史响应属性 | semantic-model-properties-guide.md § 刷新历史 | 刷新详情响应字段 |
| 数据源响应属性 | semantic-model-properties-guide.md § 数据源 | 连接和网关属性 |
| DirectQuery / LiveConnection刷新调度 | semantic-model-properties-guide.md § DQ刷新调度 | DirectQuery/LiveConnection调度设置 |
| 上游数据流链接 | semantic-model-properties-guide.md § 上游数据流 | 数据流依赖属性 |
| 按表存储模式 | semantic-model-properties-guide.md § 按表存储 | 通过TMDL设置表级存储模式 |
| TMDL语法规则 | tmdl-authoring-guide.md § TMDL语法规则 | 制表符缩进、对象声明、引号规则 |
| 建模最佳实践 | tmdl-authoring-guide.md § 建模最佳实践 | 命名规范、列规则、度量值与DAX规则、格式字符串 |
| 关系 | tmdl-authoring-guide.md § 关系 | 关系声明、键规则 |
| 层次结构 | tmdl-authoring-guide.md § 层次结构 | 层次结构声明与键规则 |
| Direct Lake指南 | tmdl-authoring-guide.md § Direct Lake指南 | Direct Lake模式配置与约束 |
| 计算表 | tmdl-authoring-guide.md § 计算表 | 基于DAX的计算表定义 |
| 日期/日历表 | tmdl-authoring-guide.md § 日期/日历表 | 日历表设置与标记 |
| 参数 | tmdl-authoring-guide.md § 参数 | 基于表达式的参数声明 |
| 注释 | tmdl-authoring-guide.md § 注释 | 模型和对象级注释 |
| TMDL文件布局与核心文件 | tmdl-advanced-features-guide.md § 文件布局 | 目录结构、database.tmdl、model.tmdl |
| 计算组 | tmdl-advanced-features-guide.md § 计算组 | 计算组表和项 |
| 安全角色 | tmdl-advanced-features-guide.md § 安全角色 | RLS/OLS角色定义 |
| 安全角色成员 | SKILL.md § 安全角色成员 | 在RLS角色中添加/列出/删除用户和组(Power BI API) |
| 翻译/区域设置 | tmdl-advanced-features-guide.md § 翻译/区域设置 | 通过区域设置文件实现本地化 |
| 透视 | tmdl-advanced-features-guide.md § 透视 | 子集视图的透视定义 |
| 函数 | tmdl-advanced-features-guide.md § 函数 | 模型中的用户自定义DAX函数 |
| 日历对象 | tmdl-advanced-features-guide.md § 日历对象 | 自动日期/时间日历表对象 |
Tool Stack
工具栈
| Tool | Role | Install |
|---|---|---|
| Primary: | Pre-installed in most dev environments |
| Parse JSON from | Pre-installed or trivial |
| Encode TMDL file content for definition payloads | Built-in |
Agent check — verify before first operation:bashaz version 2>/dev/null || echo "INSTALL: https://learn.microsoft.com/cli/azure/install-azure-cli"
| 工具 | 作用 | 安装方式 |
|---|---|---|
| 主要工具: | 多数开发环境已预装 |
| 解析 | 已预装或易于安装 |
| 为定义负载编码TMDL文件内容 | 内置工具 |
智能检查 — 首次操作前验证:bashaz version 2>/dev/null || echo "安装地址:https://learn.microsoft.com/cli/azure/install-azure-cli"
Authentication & API Audiences
身份验证与API受众
This skill uses two distinct API audiences. Using the wrong audience returns a 401.
| API | Audience ( | Use For |
|---|---|---|
| Fabric Items API | | Create/get/update/delete semantic model definitions, list items, LRO polling |
| Power BI Datasets API | | Refresh, data sources, parameters, permissions, deployment pipelines |
bash
undefined本技能使用两个不同的API受众。使用错误的受众会返回401错误。
| API | 受众( | 用途 |
|---|---|---|
| Fabric Items API | | 创建/获取/更新/删除语义模型定义、列出项、轮询LRO |
| Power BI Datasets API | | 刷新、数据源、参数、权限、部署流水线 |
bash
undefinedFabric Items API — semantic model definition operations
Fabric Items API — 语义模型定义操作
az rest --method post
--resource "https://api.fabric.microsoft.com"
--url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels"
...
--resource "https://api.fabric.microsoft.com"
--url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels"
...
az rest --method post
--resource "https://api.fabric.microsoft.com"
--url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels"
...
--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
Power BI Datasets API — 刷新、数据源、权限操作
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"
...
--resource "https://analysis.windows.net/powerbi/api"
--url "https://api.powerbi.com/v1.0/myorg/groups/$WS_ID/datasets/$DATASET_ID/refreshes"
...
---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"
...
--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 to
--resource— omitting it causes silent auth failures. Use the correct audience per the table above.az rest - Always pass on POST/PATCH/PUT calls with a
--headers "Content-Type=application/json"to the Power BI Datasets API — omitting it causes--bodyerrors.Unsupported Media Type - Include ALL definition parts in — modified + unmodified. The API replaces the entire definition; omitting parts deletes them.
updateDefinition - Never include in
.platformpayloads — it is Git integration metadata and causes errors.updateDefinition - Poll LRO to completion — ,
createItemWithDefinition, andgetDefinitionreturnupdateDefinitionwith an202 Acceptedheader. Poll until terminal state.Operation-Id - Base64-encode TMDL content — all values in definition parts must be base64-encoded.
payload - 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 and check
GET /v1/workspaces/{id}.capacityId
- 生成任何TMDL之前,请先阅读相关的TMDL参考章节 — 至少阅读TMDL语法规则和建模最佳实践。若任务涉及关系、层次结构、计算组、安全角色或翻译,还需阅读tmdl-authoring-guide.md和tmdl-advanced-features-guide.md中的对应章节。切勿凭记忆生成TMDL。
- 始终为传递
az rest参数 — 省略该参数会导致静默身份验证失败。根据上表使用正确的受众。--resource - 对包含的POST/PATCH/PUT调用,始终为Power BI Datasets API传递
--body— 省略该参数会导致“不支持的媒体类型”错误。--headers "Content-Type=application/json" - 在中包含所有定义部分 — 修改后的部分+未修改的部分。API会替换整个定义;省略的部分会被删除。
updateDefinition - 切勿在负载中包含
updateDefinition— 这是Git集成元数据,会导致错误。.platform - 轮询LRO直至完成 — 、
createItemWithDefinition和getDefinition会返回updateDefinition状态码及202 Accepted响应头。需轮询直至达到最终状态。Operation-Id - 对TMDL内容进行Base64编码 — 定义部分中所有值必须进行Base64编码。
payload - 为包含特殊字符的名称添加单引号 — 包含空格、、
.、=或:的名称,在TMDL中必须用单引号包裹。' - 创建语义模型前验证工作区是否有容量 — 调用并检查
GET /v1/workspaces/{id}字段。capacityId
PREFER
推荐做法
- (single POST) over create-then-update for new semantic models.
createItemWithDefinition - 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 — for adding/modifying individual measures, columns, or relationships, the MCP server is more efficient than full definition round-trips.
powerbi-modeling-mcp - Get definition before updating — always retrieve the current definition, modify, then POST back to avoid overwriting concurrent changes.
- Cross-reference for post-creation validation — run DAX queries to verify measures, relationships, and data.
powerbi-consumption-cli
- 使用(单次POST请求)而非先创建再更新的方式来新建语义模型。
createItemWithDefinition - 优先使用TMDL格式而非TMSL — TMDL是基于文本的格式,支持差异对比,是Fabric推荐的格式。
- 在TMDL表文件中先写度量值再写列 — 遵循TMDL约定。
- 在三重反引号中编写多行DAX — 提升复杂表达式的可读性。
- 将细粒度更改路由至— 对于添加/修改单个度量值、列或关系,MCP服务器比完整定义往返更高效。
powerbi-modeling-mcp - 更新前先获取定义 — 始终检索当前定义,修改后再POST回去,避免覆盖并发更改。
- **交叉引用**进行创建后的验证 — 运行DAX查询来验证度量值、关系和数据。
powerbi-consumption-cli
AVOID
避免操作
- for small changes — a full definition round-trip is heavy; route to
updateDefinitionfor individual object edits.powerbi-modeling-mcp - Report creation — not supported by this skill. Reports require a separate definition format (PBIR/PBIR-Legacy).
- on new objects — TMDL auto-generates lineage tags; adding them manually causes conflicts.
lineageTag - comments in TMDL — not supported. Use
//descriptions instead./// - property in TMDL — use
descriptionsyntax 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 — the API replaces the full definition; missing parts are deleted.
updateDefinition
- 对小更改使用— 完整定义往返开销大;对单个对象编辑请使用
updateDefinition。powerbi-modeling-mcp - 创建报表 — 本技能不支持报表创建。报表需要单独的定义格式(PBIR/PBIR-Legacy)。
- 在新对象上添加— TMDL会自动生成 lineage标签;手动添加会导致冲突。
lineageTag - 在TMDL中使用注释 — 不支持该语法,请使用
//描述。/// - 在TMDL中使用属性 — 请在对象上方使用
description语法。/// - 硬编码工作区/项ID — 通过REST API动态解析(请参阅COMMON-CLI.md § 在Fabric中查找工作区和项)。
- 在中仅发送修改的部分 — API会替换整个定义;缺失的部分会被删除。
updateDefinition
TMDL File Structure
TMDL文件结构
For the full definition envelope and part paths, see ITEM-DEFINITIONS-CORE.md § SemanticModel.
Required TMDL parts for and :
createItemWithDefinitionupdateDefinition| Part Path | Content | Required |
|---|---|---|
| Semantic model connection settings | Yes |
| Database properties (compatibility level) | Yes |
| Model properties (culture, default summarization) | Yes |
| Per-table: columns, measures, partitions | Yes (≥1) |
Critical:must include ALL parts — modified and unmodified. The API replaces the entire definition. Never includeupdateDefinitionin update payloads..platform
For TMDL syntax rules, naming conventions, and modeling best practices, see tmdl-authoring-guide.md.
完整的定义信封和部分路径,请参阅ITEM-DEFINITIONS-CORE.md § 语义模型。
createItemWithDefinitionupdateDefinition| 部分路径 | 内容 | 是否必填 |
|---|---|---|
| 语义模型连接设置 | 是 |
| 数据库属性(兼容级别) | 是 |
| 模型属性(区域设置、默认汇总方式) | 是 |
| 按表:列、度量值、分区 | 是(至少1个) |
重要提示:必须包含所有部分 — 修改的和未修改的。API会替换整个定义。更新负载中切勿包含updateDefinition。.platform
TMDL语法规则、命名规范和建模最佳实践,请参阅tmdl-authoring-guide.md。
Minimal TMDL Content Examples
最小TMDL内容示例
definition.pbism
definition.pbism
json
{
"version": "4.2",
"settings": {
"qnaEnabled": true
}
}json
{
"version": "4.2",
"settings": {
"qnaEnabled": true
}
}database.tmdl
database.tmdl
tmdl
database
compatibilityLevel: 1702
compatibilityMode: powerBItmdl
database
compatibilityLevel: 1702
compatibilityMode: powerBImodel.tmdl
model.tmdl
tmdl
model Model
culture: en-US
defaultPowerBIDataSourceVersion: powerBI_V3
discourageImplicitMeasuresNote:is required for Import-mode models. Without it, the API returnsdefaultPowerBIDataSourceVersion: powerBI_V3.Import from JSON supported for V3 models only
tmdl
model Model
culture: en-US
defaultPowerBIDataSourceVersion: powerBI_V3
discourageImplicitMeasures注意:对于导入模式模型,是必填项。缺失该参数会导致API返回“仅V3模型支持从JSON导入”错误。defaultPowerBIDataSourceVersion: powerBI_V3
Import-Mode Table
导入模式表
tmdl
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
Customertmdl
table Customer
/// 客户总数
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
CustomerDirect Lake Table
Direct Lake表
tmdl
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_Lakehousetmdl
expression DL_Lakehouse =
let
Source = AzureStorage.DataLake("https://onelake.dfs.fabric.microsoft.com/<WorkspaceId>/<LakehouseId>", [HierarchicalNavigation=true])
in
Source
table Sales
/// 总销售额
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_LakehouseCreate Semantic Model
创建语义模型
Full lifecycle: author TMDL → base64-encode → construct payload → POST → poll LRO.
Per COMMON-CLI.md § Item CRUD Operations and ITEM-DEFINITIONS-CORE.md § Definition Envelope:
bash
WS_ID="<workspaceId>"完整生命周期:创作TMDL → Base64编码 → 构造请求体 → POST请求 → 轮询LRO(长时间运行操作)。
请参阅COMMON-CLI.md § 项CRUD操作和ITEM-DEFINITIONS-CORE.md § 定义信封:
bash
WS_ID="<workspaceId>"1. Base64-encode each TMDL file
1. 对每个TMDL文件进行Base64编码
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)
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
2. 构造负载并创建 — 使用--verbose参数捕获HTTP状态和LRO响应头
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
--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](../../common/COMMON-CLI.md#long-running-operations-lro-pattern).
---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
--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环境** — 使用`[Convert]::ToBase64String([System.IO.File]::ReadAllBytes("file"))`替代`base64 -w 0`。
如果响应为`202 Accepted`,请按照[COMMON-CLI.md § 长时间运行操作](../../common/COMMON-CLI.md#long-running-operations-lro-pattern)中的LRO模式进行轮询。
---Get/Download Definition
获取/下载定义
Retrieve TMDL definition for backup, migration, or inspection. is a POST (not GET).
getDefinitionbash
WS_ID="<workspaceId>"
MODEL_ID="<semanticModelId>"检索TMDL定义用于备份、迁移或检查。是POST请求(而非GET)。
getDefinitionbash
WS_ID="<workspaceId>"
MODEL_ID="<semanticModelId>"1. Request definition — may return 200 (inline) or 202 (LRO)
1. 请求定义 — 可能返回200(内联结果)或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)
--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)
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)
--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
2. 如果返回202,轮询Location响应头中的URL直至状态为Succeeded,然后GET /result
3. Decode each part
3. 解码每个部分
echo "$RESPONSE" | jq -r '.definition.parts[] | .path + " " + .payload' |
while read -r path payload; do mkdir -p "$(dirname "$path")" echo "$payload" | base64 -d > "$path" done
while read -r path payload; do mkdir -p "$(dirname "$path")" echo "$payload" | base64 -d > "$path" done
---echo "$RESPONSE" | jq -r '.definition.parts[] | .path + " " + .payload' |
while read -r path payload; do mkdir -p "$(dirname "$path")" echo "$payload" | base64 -d > "$path" done
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. The API replaces the entire definition — omitted parts are deleted..platform
bash
WS_ID="<workspaceId>"
MODEL_ID="<semanticModelId>"重要规则:必须包含所有部分(修改的+未修改的)。切勿包含。API会替换整个定义 — 省略的部分会被删除。.platform
bash
WS_ID="<workspaceId>"
MODEL_ID="<semanticModelId>"1. Get current definition (see Get/Download Definition above)
1. 获取当前定义(请参阅上方的获取/下载定义)
2. Modify the relevant TMDL files
2. 修改相关TMDL文件
3. Re-encode ALL parts and POST
3. 对所有部分重新编码并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
--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.
---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
--resource "https://api.fabric.microsoft.com"
--url "https://api.fabric.microsoft.com/v1/workspaces/$WS_ID/semanticModels/$MODEL_ID/updateDefinition"
--body @/tmp/body.json
仅当需要通过定义更新显示名称或描述而必须包含`.platform`文件时,才使用`?updateMetadata=true`查询参数。
---Authoring Scope Matrix
创作范围矩阵
| Operation | Supported | Method |
|---|---|---|
| Create semantic model with TMDL | ✅ | |
| Get/download TMDL definition | ✅ | |
| Update full TMDL definition | ✅ | |
| Delete semantic model | ✅ | |
| Refresh dataset | ✅ | Power BI Datasets API (Phase 4) |
| Add/modify single measure or column | ⚠️ Route to | Full definition round-trip is inefficient |
| Create reports | ❌ | Not in scope — separate definition format (PBIR) |
| 操作 | 是否支持 | 方法 |
|---|---|---|
| 使用TMDL创建语义模型 | ✅ | |
| 获取/下载TMDL定义 | ✅ | |
| 更新完整TMDL定义 | ✅ | |
| 删除语义模型 | ✅ | |
| 刷新数据集 | ✅ | Power BI Datasets API(第4阶段) |
| 添加/修改单个度量值或列 | ⚠️ 路由至 | 完整定义往返效率低下 |
| 创建报表 | ❌ | 不在本技能范围内 — 需要单独的定义格式(PBIR) |
Refresh Operations
刷新操作
All refresh operations use the Power BI Datasets API audience ().
https://analysis.windows.net/powerbi/apibash
WS_ID="<workspaceId>"
DATASET_ID="<semanticModelId>"
PBI="https://api.powerbi.com/v1.0/myorg"所有刷新操作均使用Power BI Datasets API受众()。
https://analysis.windows.net/powerbi/apibash
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
--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
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
--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"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes?$top=5"
az rest --method get
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes?$top=5"
--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>"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes/<refreshId>"
az rest --method delete
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes/<refreshId>"
--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"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshSchedule"
az rest --method get
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshSchedule"
--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
--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
---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
--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
数据源与参数
bash
undefinedbash
undefinedGet 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"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/datasources"
az rest --method get
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/datasources"
--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"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/parameters"
az rest --method get
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/parameters"
--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
--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.
---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
--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
> 更新参数或数据源凭据后,请触发刷新以使更改生效。
---Permissions
权限
bash
undefinedbash
undefinedList dataset users
列出数据集用户
az rest --method get
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users"
az rest --method get
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users"
--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
--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
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
--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
--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`.
---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
--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
权限级别:`Read`、`ReadReshare`、`ReadExplore`、`ReadReshareExplore`。
---Security Role Memberships
安全角色成员
After defining RLS/OLS roles in TMDL (see Security Roles), use the Power BI Datasets API to assign users and groups to those roles.
bash
PBI="https://api.powerbi.com/v1.0/myorg"在TMDL中定义RLS/OLS角色后(请参阅安全角色),使用Power BI Datasets API为这些角色分配用户和组。
bash
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)]'
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/users"
| jq '[.value[] | select(.datasetUserAccessRight == "Read" and .roles != null)]'
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)]'
--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
--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
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
--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
--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
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
--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
--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`.
---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
--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
> `roles`数组接受一个或多个角色名称,必须与语义模型TMDL中定义的角色匹配。用户/组还必须至少拥有数据集的`Read`权限。`principalType`可以是`User`、`Group`或`App`。
---Deployment Pipelines
部署流水线
Deployment pipelines use the Fabric API audience ().
https://api.fabric.microsoft.combash
FABRIC="https://api.fabric.microsoft.com/v1"部署流水线使用Fabric API受众()。
https://api.fabric.microsoft.combash
FABRIC="https://api.fabric.microsoft.com/v1"List deployment pipelines
列出部署流水线
az rest --method get
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines"
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines"
az rest --method get
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines"
--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"
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines/<pipelineId>/stages"
az rest --method get
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines/<pipelineId>/stages"
--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
--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](../../common/COMMON-CLI.md#long-running-operations-lro-pattern).
---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
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines/<pipelineId>/deploy"
--headers "Content-Type=application/json"
--body @/tmp/body.json
> 省略`items`数组将部署阶段中的所有项。部署调用会返回`202 Accepted` — 请按照[LRO模式](../../common/COMMON-CLI.md#long-running-operations-lro-pattern)进行轮询。
---Agentic Workflow
智能工作流
Tool Selection Priority
工具选择优先级
- available → use MCP tools for fine-grained object changes (measures, columns, relationships)
powerbi-modeling-mcp - MCP unavailable, TMDL files available → edit TMDL files directly, deploy via updateDefinition
az rest - MCP unavailable, workspace only → use this skill: getDefinition → edit TMDL → updateDefinition
- 可用 → 使用MCP工具进行细粒度对象更改(度量值、列、关系)
powerbi-modeling-mcp - MCP不可用,但有TMDL文件 → 直接编辑TMDL文件,通过的updateDefinition部署
az rest - MCP不可用,仅能访问工作区 → 使用本技能:getDefinition → 编辑TMDL → updateDefinition
Workflow Steps
工作流步骤
- Discover workspace → list workspaces, find target by name (see COMMON-CLI.md § Finding Workspaces and Items)
- List semantic models → to find existing models or confirm name availability
GET /v1/workspaces/{id}/semanticModels - Analyze source schema → inspect source tables/columns via SQL, DAX, or Lakehouse metadata to inform star schema design
- Design star schema → identify fact and dimension tables, define relationship keys, plan measures
- Author TMDL files → create ,
definition.pbism,database.tmdl, and table files per Minimal TMDL Content Examples and tmdl-authoring-guide.mdmodel.tmdl - Create relationships → define in table TMDL files before creating measures that depend on them
- Create measures → add explicit measures with for all aggregatable values
formatString - Deploy → base64-encode all parts → POST createItemWithDefinition (see Create Semantic Model)
- Verify → run validation checks (see below)
- Refresh → trigger dataset refresh via Refresh Operations
- Validate with DAX → use powerbi-consumption-cli to run DAX queries against the deployed model
- 发现工作区 → 列出工作区,按名称找到目标工作区(请参阅COMMON-CLI.md § 查找工作区和项)
- 列出语义模型 → 调用查找现有模型或确认名称可用
GET /v1/workspaces/{id}/semanticModels - 分析源架构 → 通过SQL、DAX或湖仓元数据检查源表/列,为星型架构设计提供依据
- 设计星型架构 → 识别事实表和维度表,定义关系键,规划度量值
- 创作TMDL文件 → 根据最小TMDL内容示例和tmdl-authoring-guide.md创建、
definition.pbism、database.tmdl和表文件model.tmdl - 创建关系 → 在依赖关系的度量值创建前,在表TMDL文件中定义关系
- 创建度量值 → 为所有可聚合值添加带的显式度量值
formatString - 部署 → 对所有部分进行Base64编码 → POST调用createItemWithDefinition(请参阅创建语义模型)
- 验证 → 运行验证检查(如下所示)
- 刷新 → 通过刷新操作触发数据集刷新
- 使用DAX验证 → 使用powerbi-consumption-cli对已部署模型运行DAX查询
Post-Creation Validation
创建后验证
- TMDL structure — verify all required parts are present (definition.pbism, database.tmdl, model.tmdl, ≥1 table)
- Test measures — run for each measure via DAX
EVALUATE { [Measure Name] } - Verify relationships — confirm cardinality, cross-filter direction, matching on both sides
dataType - Verify columns — confirm mappings and
sourceColumnmatch source schemadataType - Check for duplicates — no duplicate measure names or orphan objects
- TMDL结构 — 验证所有必填部分是否存在(definition.pbism、database.tmdl、model.tmdl、至少1个表)
- 测试度量值 — 通过DAX运行来测试每个度量值
EVALUATE { [度量值名称] } - 验证关系 — 确认基数、交叉筛选方向、两侧匹配
dataType - 验证列 — 确认映射和
sourceColumn与源架构匹配dataType - 检查重复项 — 没有重复的度量值名称或孤立对象
Troubleshooting
故障排除
Early-abort rule: If bothreturnsgetDefinition(on an item you can list/GET) and the Power BI refresh API returns404 EntityNotFoundwith403 Forbidden, stop retrying immediately — the user almost certainly has only Viewer role on the workspace. Verify by calling"identity None"; if that also returnsGET /v1/workspaces/{id}/roleAssignments, 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.403 InsufficientWorkspaceRole
| Symptom | Cause | Fix |
|---|---|---|
| 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 |
| Insufficient permissions masquerading as 404 — getDefinition requires Contributor+ | Check workspace role first; do not retry with different URL formats |
| User is Viewer on the workspace | Confirms Viewer role — all authoring and most read operations are blocked |
| Wrong or missing | Use |
| Wrong audience | Use |
| Missing request body | Pass |
| LRO poll never completes | Token expired during long operation | Re-acquire token in poll loop; increase Retry-After interval |
| Didn't follow LRO to completion | Poll |
| TMDL validation error on create/update | Syntax error in TMDL content | Check TMDL rules in 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 | | Remove |
| Base64 decode produces garbled content | Wrong encoding or line wrapping | Use |
| 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 |
| Manually added | Remove |
| DAX error testing measures | Measure name case mismatch | DAX measure names are case-sensitive; match exactly |
Attempting | DAX | Use the Power BI REST API instead: |
提前终止规则:如果同时出现返回getDefinition(针对你能列出/GET的项)且Power BI刷新API返回404 EntityNotFound并附带403 Forbidden,请立即停止重试 — 用户几乎可以肯定仅拥有工作区的查看者角色。通过调用"identity None"验证;如果该调用也返回GET /v1/workspaces/{id}/roleAssignments,请向用户确认他们需要贡献者或更高角色。不要尝试不同的URL格式、端点或参数 — 问题出在权限,而非API使用方式。403 InsufficientWorkspaceRole
| 症状 | 原因 | 修复方案 |
|---|---|---|
Power BI API返回 | 用户拥有查看者角色 — 刷新、数据源和权限API需要贡献者及以上角色 | 立即停止操作。请用户申请工作区的贡献者/成员/管理员角色 |
getDefinition返回 | 权限不足伪装成404错误 — getDefinition需要贡献者及以上角色 | 先检查工作区角色;不要尝试不同的URL格式 |
roleAssignments返回 | 用户是工作区的查看者 | 确认查看者角色 — 所有创作和大多数读取操作均被阻止 |
Fabric API返回 | | 使用 |
Power BI API返回 | 受众错误 | 使用 |
getDefinition返回 | 缺少请求体 | 传递 |
| LRO轮询永远无法完成 | 长时间操作期间令牌过期 | 在轮询循环中重新获取令牌;增加Retry-After间隔 |
返回 | 未完成LRO轮询 | 轮询 |
| 创建/更新时出现TMDL验证错误 | TMDL内容存在语法错误 | 检查tmdl-authoring-guide.md中的TMDL规则;编码前先验证 |
| updateDefinition后部分内容缺失 | 仅发送了修改的部分 | 每次更新必须包含所有部分(修改的+未修改的) |
更新中包含 | 默认不接受 | 从部分中移除 |
| Base64解码产生乱码 | 编码错误或换行 | 使用 |
| 刷新因数据源错误失败 | 凭据过期或参数错误 | 检查数据源和参数;必要时更新凭据 |
| 部署流水线失败 | 工作区未分配到阶段 | 部署前将工作区分配到流水线阶段 |
新对象出现 | 手动添加了 | 从新对象中移除 |
| 测试度量值时出现DAX错误 | 度量值名称大小写不匹配 | DAX度量值名称区分大小写;需完全匹配 |
尝试通过DAX的 | DAX | 请改用Power BI REST API: |
Examples
示例
Create a Semantic Model from TMDL
从TMDL创建语义模型
bash
WS_ID="<workspaceId>"bash
WS_ID="<workspaceId>"Encode all TMDL files
编码所有TMDL文件
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
--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
undefinedPBISM=$(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
--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
undefinedDownload a Semantic Model Definition
下载语义模型定义
bash
WS_ID="<workspaceId>"
MODEL_ID="<semanticModelId>"bash
WS_ID="<workspaceId>"
MODEL_ID="<semanticModelId>"Get definition (may return 202 — follow LRO)
获取定义(可能返回202 — 请遵循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)
--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)
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)
--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
while IFS=$'\t' read -r path payload; do mkdir -p "$(dirname "$path")" echo "$payload" | base64 -d > "$path" echo "Saved: $path" done
undefinedecho "$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 "已保存:$path" done
while IFS=$'\t' read -r path payload; do mkdir -p "$(dirname "$path")" echo "$payload" | base64 -d > "$path" echo "已保存:$path" done
undefinedTrigger a Refresh and Check Status
触发刷新并检查状态
bash
WS_ID="<workspaceId>"
DATASET_ID="<semanticModelId>"
PBI="https://api.powerbi.com/v1.0/myorg"bash
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
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes"
--body @/tmp/body.json
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
--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"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes?$top=1"
undefinedaz rest --method get
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes?$top=1"
--resource "https://analysis.windows.net/powerbi/api"
--url "$PBI/groups/$WS_ID/datasets/$DATASET_ID/refreshes?$top=1"
undefinedDeploy to Production via Pipeline
通过流水线部署到生产环境
bash
FABRIC="https://api.fabric.microsoft.com/v1"
PIPELINE_ID="<pipelineId>"bash
FABRIC="https://api.fabric.microsoft.com/v1"
PIPELINE_ID="<pipelineId>"Deploy from Test (stage 1) to Production (stage 2)
从测试阶段(阶段1)部署到生产阶段(阶段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
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines/$PIPELINE_ID/deploy"
--body @/tmp/body.json
undefinedcat > /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
--resource "https://api.fabric.microsoft.com"
--url "$FABRIC/deploymentPipelines/$PIPELINE_ID/deploy"
--body @/tmp/body.json
undefined