mcpField
F
flowstudio-power-automate-monitoring

flowstudio-power-automate-monitoring

github.com/github云与 DevOps40.5k785 次安装1 天前更新
代码仓库

关于 flowstudio-power-automate-monitoring

FlowStudio 的 Power Automate 监控技能,通过租户缓存数据帮助管理员检查流程健康状况、运行记录及环境、创建者、连接和应用;使用 store 工具需要 Pro+ 权限。

主要功能

  1. 01列出流程及失败率
  2. 02查看汇总和运行历史
  3. 03检查环境与连接
  4. 04盘点创建者和 Power Apps
  5. 05设置监控及治理元数据

适用场景

  1. 01查找失败率较高的流程
  2. 02查看某流程近期失败运行
  3. 03审计创建者及其资产
  4. 04盘点租户环境和应用

MCP 相关

通过 FlowStudio MCP 的 store 工具读取 Power Automate 缓存数据,并更新流程监控元数据。FlowStudio for Teams 或 MCP Pro+ 订阅者可使用这些工具。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/github/awesome-copilot --skill flowstudio-power-automate-monitoring

安装后在 Claude Code 中输入/flowstudio-power-automate-monitoring确认已加载。

详细介绍

使用 FlowStudio MCP 监控 Power Automate

通过 FlowStudio MCP 缓存存储监控流运行状况、跟踪失败率并清点租户资产 —— 读取速度快,不受 PA API 速率限制,并且包含治理元数据和修复提示。

⚠️ 需要 Pro+ 订阅。 本技能调用的 store_* 工具仅适用于 FlowStudio for Teams 或 MCP Pro+ 订阅者。

如果用户没有 Pro+ 访问权限: 首次调用 store_* 工具将返回 403/404 错误。发生这种情况时:

  1. 停止调用 store 工具
  2. 告知用户此功能需要 Pro+ 订阅
  3. 向他们提供链接 https://mcp.flowstudio.app/pricing
  4. 如果他们的问题可以用实时工具回答(例如“列出一个环境中的流”),则建议改用 flowstudio-power-automate-mcp 技能

发现: 通过 tool_search 而不是 tools/list 加载工具 schema —— 使用 query: "select:list_store_flows,get_store_flow_summary" 调用常用监控工具,或使用 query: "skill:governance" 加载完整集合(服务端的治理包也涵盖大多数监控读取 —— 本技能与 flowstudio-power-automate-governance 共享底层工具系列)。本技能涵盖响应结构、行为说明和工作流模式 —— 这些是 tool_search 无法告诉你的。如果本文档与实际 API 响应不一致,以 API 为准。


监控工作原理

FlowStudio 每天为每个订阅者扫描 Power Automate API 并缓存结果。共有两个级别:

  • 所有流都会扫描元数据:定义、连接、所有者、触发器类型以及聚合运行统计信息(runPeriodTotal、runPeriodFailRate 等)。环境、应用、连接和制作者也会被扫描。
  • 受监控的流(monitor: true)还会额外获取每次运行的详细信息:包含状态、持续时间、失败操作名称和修复提示的单独运行记录。这正是 get_store_flow_runs 和 get_store_flow_summary 的数据来源。

数据新鲜度: 检查 get_store_flow 上的 scanned 字段,查看某个流上次被扫描的时间。如果数据陈旧,扫描管道可能未在运行。

启用监控: 通过 update_store_flow 或 FlowStudio for Teams 应用设置 monitor: true (如何选择流)。

指定关键流: 对业务关键流使用 update_store_flow 并设置 critical=true。这将启用治理技能的通知规则管理,从而在关键流上自动配置失败警报。


工具

工具用途
list_store_flows列出流及其失败率和监控筛选条件
get_store_flow完整缓存记录:运行统计、所有者、层级、连接、定义(包含 triggerUrl 字段)
get_store_flow_summary聚合运行统计:成功/失败率、平均/最大持续时间
get_store_flow_runs每次运行的历史记录,包含持续时间、状态、失败操作、修复建议(筛选 status="Failed" 可仅查看错误)
update_store_flow设置监控标记、通知规则、标签、治理元数据
list_store_environments所有 Power Platform 环境
list_store_connections所有连接
list_store_makers所有制作者(公民开发者)
get_store_maker制作者详情:流/应用数量、许可证、账户状态
list_store_power_apps所有 Power Apps 画布应用

如需启动/停止,请使用 monitor-flow 包中的 set_live_flow_state (tool_search query: "select:set_live_flow_state")—— 缓存在下次扫描时重新同步。之前的 set_store_flow_state 便捷包装器已弃用。


Store 与 Live 的对比

问题使用 Store使用 Live
有多少流程正在失败?list_store_flows—
30 天内的失败率是多少?get_store_flow_summary—
显示某个流程的错误历史get_store_flow_runs(筛选 status="Failed")—
这个流程是谁创建的?get_store_flow → 解析 owners—
读取完整的流程定义get_store_flow 中有(JSON 字符串)get_live_flow(结构化)
从某次运行检查操作的输入/输出—get_live_flow_run_action_outputs
重新提交失败的运行—resubmit_live_flow_run

Store 工具回答"发生了什么?"和"它有多健康?" Live 工具回答"具体哪里出错了?"和"现在修复它。"

如果 get_store_flow_runs 或 get_store_flow_summary 返回空结果, 请检查:(1) 流程上的 monitor: true 是否开启?以及 (2) scanned 字段 是否是最新的?使用 get_store_flow 来验证这两项。


响应结构

list_store_flows

直接返回数组。筛选条件:monitor(bool)、rule_notify_onfail(bool)、 rule_notify_onmissingdays(bool)。

[
  {
    "id": "Default-<envGuid>.<flowGuid>",
    "displayName": "Stripe subscription updated",
    "state": "Started",
    "triggerType": "Request",
    "triggerUrl": "https://...",
    "tags": ["#operations", "#sensitive"],
    "environmentName": "Default-aaaaaaaa-...",
    "monitor": true,
    "runPeriodFailRate": 0.012,
    "runPeriodTotal": 82,
    "createdTime": "2025-06-24T01:20:53Z",
    "lastModifiedTime": "2025-06-24T03:51:03Z"
  }
]

id 格式:Default-<envGuid>.<flowGuid>。在第一个 . 处分割即可得到 environmentName 和 flowName。

triggerUrl 和 tags 是可选的。有些条目信息稀疏(只有 id + monitor)—— 跳过没有 displayName 的条目。

list_store_flows 上的标签是从流程的 description 字段自动提取的(制作者的话题标签,如 #operations)。通过 update_store_flow(tags=...) 写入的标签单独存储,只会在 get_store_flow 中可见 —— 它们不会出现在列表响应中。

get_store_flow

完整的缓存记录。关键字段:

类别字段
身份name、displayName、environmentName、state、triggerType、triggerKind、tier、sharingType
运行统计runPeriodTotal、runPeriodFails、runPeriodSuccess、runPeriodFailRate、runPeriodSuccessRate、runPeriodDurationAverage/Max/Min(毫秒)、runTotal、runFails、runFirst、runLast、runToday
治理monitor(bool)、rule_notify_onfail(bool)、rule_notify_onmissingdays(number)、rule_notify_email(string)、log_notify_onfail(ISO)、description、tags
新鲜度scanned(ISO)、nextScan(ISO)
生命周期deleted(bool)、deletedTime(ISO)
JSON 字符串actions、connections、owners、complexity、definition、createdBy、security、triggers、referencedResources、runError —— 全部都需要 json.loads() 来解析

时长字段(runPeriodDurationAverage、Max、Min)的单位是 毫秒。除以 1000 得到秒数。

runError 以 JSON 字符串形式包含上一次运行的错误。解析它: json.loads(record["runError"]) —— 无错误时返回 {}。

get_store_flow_summary

某个时间窗口内的聚合统计(默认:最近 7 天)。

{
  "flowKey": "Default-<envGuid>.<flowGuid>",
  "windowStart": null,
  "windowEnd": null,
  "totalRuns": 82,
  "successRuns": 81,
  "failRuns": 1,
  "successRate": 0.988,
  "failRate": 0.012,
  "averageDurationSeconds": 2.877,
  "maxDurationSeconds": 9.433,
  "firstFailRunRemediation": null,
  "firstFailRunUrl": null
}

当该流程在此窗口内没有运行数据时,返回全零。 使用 startTime 和 endTime(ISO 8601)参数来更改窗口。

get_store_flow_runs

直接返回缓存的运行记录数组。参数:startTime、endTime、 status(数组 —— 传入 ["Failed"] 仅查看错误,传入 ["Succeeded"], 或省略以查看全部)。

当窗口内没有运行数据时返回 []。

触发器 URL

直接从 get_store_flow(缓存)或 get_live_flow(实时)读取 triggerUrl 字段。对于非 HTTP 触发器,它为 null。

启动 / 停止流程

使用 monitor-flow 服务包中的 set_live_flow_state。缓存在 下一次每日扫描时更新;如果你需要更快的缓存新鲜度,请在状态变更后 调用 get_live_flow 来确认,并让下一次扫描同步。

update_store_flow

更新治理元数据。仅更新提供的字段(合并)。 返回完整的更新后记录(与 get_store_flow 结构相同)。

可设置字段:monitor(bool)、rule_notify_onfail(bool)、 rule_notify_onmissingdays(数字,0=禁用)、 rule_notify_email(逗号分隔)、description、tags、 businessImpact、businessJustification、businessValue、 ownerTeam、ownerBusinessUnit、supportGroup、supportEmail、 critical(bool)、tier、security。

list_store_environments

直接数组。

[
  {
    "id": "Default-aaaaaaaa-...",
    "displayName": "Flow Studio (default)",
    "sku": "Default",
    "type": "NotSpecified",
    "location": "australia",
    "isDefault": true,
    "isAdmin": true,
    "isManagedEnvironment": false,
    "createdTime": "2017-01-18T01:06:46Z"
  }
]

sku 值:Default、Production、Developer、Sandbox、Teams。

list_store_connections

直接数组。可能非常大(1500+ 项)。

[
  {
    "id": "<environmentId>.<connectionId>",
    "displayName": "[email protected]",
    "createdBy": "{\"id\":\"...\",\"displayName\":\"...\",\"email\":\"...\"}",
    "environmentName": "...",
    "statuses": "[{\"status\":\"Connected\"}]"
  }
]

createdBy 和 statuses 是 JSON 字符串 — 使用 json.loads() 解析。

list_store_makers

直接数组。

[
  {
    "id": "09dbe02f-...",
    "displayName": "Sample Maker",
    "mail": "[email protected]",
    "deleted": false,
    "ownerFlowCount": 199,
    "ownerAppCount": 209,
    "userIsServicePrinciple": false
  }
]

已删除的制作者具有 deleted: true,且没有 displayName/mail 字段。

get_store_maker

完整的制作者记录。关键字段:displayName、mail、userPrincipalName、 ownerFlowCount、ownerAppCount、accountEnabled、deleted、country、 firstFlow、firstFlowCreatedTime、lastFlowCreatedTime、 firstPowerApp、lastPowerAppCreatedTime、 licenses(M365 SKU 的 JSON 字符串)。

list_store_power_apps

直接数组。

[
  {
    "id": "<environmentId>.<appId>",
    "displayName": "My App",
    "environmentName": "...",
    "ownerId": "09dbe02f-...",
    "ownerName": "Catherine Han",
    "appType": "Canvas",
    "sharedUsersCount": 0,
    "createdTime": "2023-08-18T01:06:22Z",
    "lastModifiedTime": "2023-08-18T01:06:22Z",
    "lastPublishTime": "2023-08-18T01:06:22Z"
  }
]

常见工作流

查找不正常的流
1. list_store_flows
2. Filter where runPeriodFailRate > 0.1 and runPeriodTotal >= 5
3. Sort by runPeriodFailRate descending
4. For each: get_store_flow for full detail
检查特定流的健康状况
1. get_store_flow → check scanned (freshness), runPeriodFailRate, runPeriodTotal
2. get_store_flow_summary → aggregated stats with optional time window
3. get_store_flow_runs(status=["Failed"]) → per-run failure detail with remediation hints
4. If deeper diagnosis needed → switch to live tools:
   get_live_flow_runs → get_live_flow_run_action_outputs
为流启用监控
1. update_store_flow with monitor=true
2. Optionally set rule_notify_onfail=true, rule_notify_email="[email protected]"
3. Run data will appear after the next daily scan
每日健康检查
1. list_store_flows
2. Flag flows with runPeriodFailRate > 0.2 and runPeriodTotal >= 3
3. Flag monitored flows with state="Stopped" (may indicate auto-suspension)
4. For critical failures → get_store_flow_runs(status=["Failed"]) for remediation hints
制作者审计
1. list_store_makers
2. Identify deleted accounts still owning flows (deleted=true, ownerFlowCount > 0)
3. get_store_maker for full detail on specific users
清单
1. list_store_environments → environment count, SKUs, locations
2. list_store_flows → flow count by state, trigger type, fail rate
3. list_store_power_apps → app count, owners, sharing
4. list_store_connections → connection count per environment

相关技能

  • flowstudio-power-automate-mcp — 基础技能:连接设置、MCP 辅助工具、工具发现
  • flowstudio-power-automate-debug — 使用操作级输入/输出进行深度诊断(实时 API)
  • flowstudio-power-automate-build — 构建和部署流定义
  • flowstudio-power-automate-governance — 治理元数据、标记、通知规则、CoE 模式

评论

支持 Markdown