关于 power-automate-governance
这是通过 FlowStudio 缓存存储对 Power Automate 流程进行分类、标记和审计的治理技能,适用于治理与合规工作;元数据更新仅写入 FlowStudio 存储,不会修改底层流程。
主要功能
- 01审计治理元数据
- 02分类并标记流程
- 03检查制作者和所有权记录
- 04配置监控与通知
- 05审计连接器和安全信号
适用场景
- 01查找缺少合规字段的流程
- 02识别关联离职制作者的流程
- 03准备连接器或安全审查
- 04为关键流程配置告警
MCP 相关
使用 FlowStudio MCP 的 `store_*` 工具读取缓存的流程和租户数据,并更新治理元数据。这些更新仅影响 FlowStudio 存储,不会更改 Power Automate 流程属性或所有权。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ ninihen1/ power-automate-mcp-skills --skill power-automate-governance安装后在 Claude Code 中输入/power-automate-governance确认已加载。
详细介绍
使用 FlowStudio MCP 管理 Power Automate
通过 FlowStudio MCP 缓存存储大规模分类、标记和管理 Power Automate 流程——无需 Dataverse、CoE Starter Kit 或 Power Automate 门户。
此技能使用与 power-automate-monitoring 相同的 store_* 工具系列,但用途不同:治理会写入元数据(update_store_flow),并读取审计和分类结果;监控则读取相同工具,以获取运行状况结果。无需记住哪些技能“归属”哪个工具——根据用户正在做什么来选择即可。对于运行状况检查和失败率仪表板,请改用 power-automate-monitoring。
⚠️ 需要 Pro+ 订阅。 此技能调用的
store_*工具仅适用于 FlowStudio for Teams 或 MCP Pro+ 订阅用户。如果用户没有 Pro+ 访问权限: 第一次调用
store_*工具时会返回 403/404 错误。发生这种情况时:
- 停止调用存储工具
- 告知用户治理功能需要 Pro+ 订阅
- 提供链接:https://mcp.flowstudio.app/pricing
发现工具: 请通过元工具加载工具架构,而不是使用
tools/list——调用tool_search并设置query: "skill:governance"获取规范工具包,或设置query: "select:update_store_flow"获取单个工具。此技能涵盖工作流模式和字段语义——这些是tool_search无法告知你的内容。如果本文档与实际 API 响应不一致,以 API 为准。
关键:如何提取流程 ID
list_store_flows 返回的 id 格式为 <environmentId>.<flowId>。必须按第一个 . 拆分,以获取其他所有工具所需的 environmentName 和 flowName:
id = "Default-<envGuid>.<flowGuid>"
environmentName = "Default-<envGuid>" (everything before first ".")
flowName = "<flowGuid>" (everything after first ".")
另外:跳过没有 displayName 或 state=Deleted 的条目——这些是稀疏记录,或是 Power Automate 中已不存在的流程。如果已删除的流程具有 monitor=true,建议停用监控(使用 update_store_flow 设置 monitor=false),以释放监控名额(标准套餐包含 20 个)。
写入工具:update_store_flow
update_store_flow 仅将治理元数据写入 FlowStudio 缓存——不会修改 Power Automate 中的流程。这些字段不会通过 get_live_flow 或 PA 门户显示。它们仅存在于 FlowStudio 存储中,供 FlowStudio 的扫描管道和通知规则使用。
这意味着:
ownerTeam/supportEmail— 设置 FlowStudio 认定的治理联系人。不会更改实际的 PA 流程所有者。rule_notify_email— 设置接收 FlowStudio 失败/缺少运行通知的人员。不会更改 Microsoft 内置的流程失败警报。monitor/critical/businessImpact— 仅用于 FlowStudio 分类。Power Automate 没有对应字段。
合并语义——只更新你提供的字段。返回完整的更新后记录(结构与 get_store_flow 相同)。
必需参数:environmentName、flowName。其他字段均为可选。
可设置字段
| 字段 | 类型 | 用途 |
|---|---|---|
monitor | bool | 启用运行级扫描(标准方案:包含 20 个流) |
rule_notify_onfail | bool | 在任何运行失败时发送电子邮件通知 |
rule_notify_onmissingdays | number | 当流在 N 天内未运行时发送通知(0 = 禁用) |
rule_notify_email | string | 逗号分隔的通知收件人 |
description | string | 该流的功能 |
tags | string | 分类标签(也会从描述的 #hashtags 中自动提取) |
businessImpact | string | Low / Medium / High / Critical |
businessJustification | string | 该流存在的原因、它自动化了什么流程 |
businessValue | string | 业务价值说明 |
ownerTeam | string | 负责团队 |
ownerBusinessUnit | string | 业务部门 |
supportGroup | string | 支持升级组 |
supportEmail | string | 支持联系邮箱 |
critical | bool | 指定为业务关键 |
tier | string | Standard 或 Premium |
security | string | 安全分类或备注 |
注意
security:get_store_flow上的security字段 包含结构化 JSON(例如{"triggerRequestAuthenticationType":"All"})。 写入像"reviewed"这样的普通字符串会覆盖它。要将某个 流标记为已通过安全审查,请改用tags。
治理工作流
1. 合规详情审查
识别缺少所需治理元数据的流。
1. Ask the user which compliance fields they require
2. list_store_flows
3. For each active flow: split id, call get_store_flow, check required fields
4. Report non-compliant flows with missing fields listed
5. For updates: ask for values, then update_store_flow(...provided fields)
常见合规字段:description、businessImpact、
businessJustification、ownerTeam、supportEmail、monitor、
rule_notify_onfail、critical。标记之前请先询问用户的策略。
2. 孤立资源检测
查找由已删除或已禁用的 Azure AD 账户拥有的流。
1. list_store_makers
2. Filter where deleted=true AND ownerFlowCount > 0
3. list_store_flows → collect all flows
4. For each active flow: split id, get_store_flow, parse owners JSON
5. Match owner principalId against orphaned maker id
6. Reassign governance contact or stop/tag for decommission
update_store_flow 不会转移实际的 PA 所有权;请使用管理中心
或 PowerShell 来完成。有些看起来孤立的流是系统生成的;适当时
应给它们打标签,而不是重新分配。存储覆盖度仅与最近一次扫描一样新。
3. 归档评分计算
计算每个流的非活动评分(0-7)以识别清理候选对象。
1. list_store_flows
2. For each active flow: split id, get_store_flow
3. Add 1 point each: created≈modified, test/demo/temp/copy name, age >12mo,
stopped/suspended, no owners, no recent runs, complexity.actions < 5
4. Score 5-7: recommend archive; 3-4: tag #archive-review; 0-2: active
5. For confirmed archive: set_live_flow_state(..., "Stopped") and append #archived
通过 MCP 归档意味着停止该流并给它打标签。删除需要门户或 管理员 PowerShell。
4. 连接器审计
审计受监控流中正在使用哪些连接器。适用于 DLP 影响分析和高级许可证规划。
1. list_store_flows(monitor=true)
2. For each active flow: split id, get_store_flow, parse connections JSON
3. Group by apiName; flag Premium tier, HTTP connectors, custom connectors
4. Report inventory to user
尽可能限定在受监控的流范围内;每次 get_store_flow 调用都耗费时间。
list_store_connections 列出的是连接实例,而不是每个
流的连接器使用情况。DLP 策略未公开;请向用户询问连接器分类。
5. 通知规则管理
大规模配置流的监控和告警。
Enable failure alerts on all critical flows:
1. list_store_flows(monitor=true)
2. For each active flow: split id, get_store_flow
3. If critical=true and rule_notify_onfail is false, update_store_flow(...,
rule_notify_onfail=true, rule_notify_email="[email protected]")
Enable missing-run detection for scheduled flows:
1. list_store_flows(monitor=true)
2. For active Recurrence flows: get_store_flow
3. If rule_notify_onmissingdays is 0/missing, update_store_flow(...,
rule_notify_onmissingdays=2)
在批量启用 monitor=true 之前,请检查监控限制。如果没有流设置了
critical=true,请在配置告警之前将其报告为治理缺口。
6. 分类与标签
按连接器类型、业务功能或风险级别批量分类流。
Auto-tag by connector:
1. list_store_flows
2. For each active flow: split id, get_store_flow, parse connections JSON
3. Map apiName values to tags (#sharepoint, #teams, #email, #custom-connector)
4. Read existing store tags, append new tags, update_store_flow(tags=...)
存储标签和描述话题标签是两套独立系统。tags= 会覆盖
存储标签,因此请读取/追加/写入。除非被要求,否则避免覆盖计算得出的 tier。
7. 创建者离职处理
当员工离职时,识别他们的流和应用,并重新分配 FlowStudio 治理联系人和通知收件人。
1. get_store_maker(makerKey="<departing-user-aad-oid>")
→ check ownerFlowCount, ownerAppCount, deleted status
2. list_store_flows → collect all flows
3. For each active flow: split id, get_store_flow, parse owners JSON
4. Flag flows whose owner principalId matches the departing user's OID
5. list_store_power_apps → filter ownerId
6. For kept flows: update ownerTeam/supportEmail/rule_notify_email; consider
add_live_flow_to_solution before account deletion
7. For retired flows: set_live_flow_state(..., "Stopped") and tag #decommissioned
8. Report: flows reassigned, flows migrated to solutions, flows stopped,
apps needing manual reassignment
这会更改 FlowStudio 治理联系人,而不是实际的 PA 所有权。Power Apps 所有权变更属于手动/管理中心工作。
8. 安全审查
使用缓存的存储数据审查流是否存在潜在安全问题。
1. list_store_flows(monitor=true)
2. For each active flow: split id, get_store_flow
3. Parse security/connections/referencedResources JSON; read sharingType top-level
4. Report findings; for reviewed flows append #security-reviewed tag
安全信号:security.triggerRequestAuthenticationType、sharingType、
connections、referencedResources、tier。切勿覆盖结构化的
security 字段;而应给已审查的流打标签。
9. 环境治理
审计环境的合规性和蔓延情况。
1. list_store_environments
Skip entries without displayName (tenant-level metadata rows)
2. Flag:
- Developer environments
- Non-managed environments
- Environments where service account lacks admin access (isAdmin=false)
3. list_store_flows → group by environmentName
4. list_store_connections → group by environmentName
10. 治理仪表板
生成租户范围的治理摘要。
Efficient metrics (list calls only):
1. total_flows = len(list_store_flows())
2. monitored = len(list_store_flows(monitor=true))
3. with_onfail = len(list_store_flows(rule_notify_onfail=true))
4. makers/apps/envs/conns = list_store_makers/list_store_power_apps/list_store_environments/list_store_connections
5. Compute monitoring %, notification %, orphan count, high-failure count
Detailed metrics (require get_store_flow per flow — expensive for large tenants):
- Compliance %: flows with businessImpact set / total active flows
- Undocumented count: flows without description
- Tier breakdown: group by tier field
字段参考:治理中使用的 get_store_flow 字段
以下字段均已确认存在于 get_store_flow 响应中。
标有 * 的字段也可通过 list_store_flows 获取(成本更低)。
| 字段 | 类型 | 治理用途 |
|---|---|---|
displayName * | string | 归档评分(检测测试/演示名称) |
state * | string | 归档评分、生命周期管理 |
tier | string | 许可证审计(Standard 与 Premium) |
monitor * | bool | 是否正在主动监控此流程? |
critical | bool | 业务关键标记(可通过 update_store_flow 设置) |
businessImpact | string | 合规分类 |
businessJustification | string | 合规证明 |
ownerTeam | string | 所有权责任归属 |
supportEmail | string | 升级联系邮箱 |
rule_notify_onfail | bool | 是否已配置失败提醒? |
rule_notify_onmissingdays | number | 是否已配置 SLA 监控? |
rule_notify_email | string | 提醒接收者 |
description | string | 文档完整性 |
tags | string | 分类 — list_store_flows 仅显示从描述中提取的主题标签;通过 update_store_flow 写入的存储标签需要使用 get_store_flow 读取 |
runPeriodTotal * | number | 活动水平 |
runPeriodFailRate * | number | 健康状态 |
runLast | ISO string | 上次运行时间戳 |
scanned | ISO string | 数据新鲜度 |
deleted | bool | 生命周期跟踪 |
createdTime * | ISO string | 归档评分(使用年限) |
lastModifiedTime * | ISO string | 归档评分(陈旧程度) |
owners | JSON string | 孤立项检测、所有权审计 — 使用 json.loads() 解析 |
connections | JSON string | 连接器审计、层级 — 使用 json.loads() 解析 |
complexity | JSON string | 归档评分(简易程度)— 使用 json.loads() 解析 |
security | JSON string | 身份验证类型审计 — 使用 json.loads() 解析,包含 triggerRequestAuthenticationType |
sharingType | string | 过度共享检测(顶层字段,不在 security 内) |
referencedResources | JSON string | URL 审计 — 使用 json.loads() 解析 |
相关技能
power-automate-monitoring— 健康检查、失败率、清单(只读)power-automate-mcp— 基础技能:连接设置、MCP 辅助工具、工具发现power-automate-debug— 使用操作级输入/输出进行深入诊断power-automate-build— 构建和部署流程定义