mcpField
F
flowstudio-power-automate-governance

flowstudio-power-automate-governance

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

关于 flowstudio-power-automate-governance

此技能通过 FlowStudio 缓存存储指导 Power Automate 流程的治理审计和元数据更新,适用于分类、合规审查、所有权跟进和租户级治理;使用存储工具需订阅 FlowStudio for Teams 或 MCP Pro+。

主要功能

  1. 01审查流程治理元数据
  2. 02分类并标记流程
  3. 03配置监控和通知规则
  4. 04审计连接器和安全信号
  5. 05汇总租户治理情况

适用场景

  1. 01查找缺少必需合规字段的流程
  2. 02识别关联已停用账户的流程
  3. 03检查受监控流程使用的连接器
  4. 04生成租户级治理摘要

MCP 相关

使用 FlowStudio MCP 存储工具读取缓存的流程、制作者、环境和连接数据,并更新流程治理元数据。使用这些存储工具需具备 FlowStudio for Teams 或 MCP Pro+ 访问权限。

安装

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

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

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

详细介绍

使用 FlowStudio MCP 进行 Power Automate 治理

通过 FlowStudio MCP 缓存存储,大规模地对 Power Automate 流进行分类、标记和治理——无需 Dataverse,无需 CoE Starter Kit,也无需 Power Automate 门户。

本技能使用与 flowstudio-power-automate-monitoring 相同的 store_* 工具族,但意图不同:治理写入元数据(update_store_flow),并读取以实现审计和分类结果。监控则读取相同的工具以实现运行状况结果。不要试图记住哪个技能"拥有"哪个工具——根据用户正在做的事情来选择。对于健康检查和失败率仪表板,请加载 flowstudio-power-automate-monitoring。

⚠️ 需要 Pro+ 订阅。 本技能会调用 store_* 工具,这些工具仅对 FlowStudio for Teams 或 MCP Pro+ 订阅者可用。

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

  1. 停止调用 store 工具
  2. 告知用户治理功能需要 Pro+ 订阅
  3. 将他们引导至 https://mcp.flowstudio.app/pricing

发现机制: 通过元工具而非 tools/list 加载工具 schema —— 使用 query: "skill:governance" 调用 tool_search 以获取标准捆绑包,或使用 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,建议禁用监控(使用 monitor=false 调用 update_store_flow),以释放一个监控名额(标准计划包含 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。所有其他字段均为可选。

可设置字段
字段类型用途
monitorbool启用运行级扫描(标准方案:包含 20 个流)
rule_notify_onfailbool在任何运行失败时发送电子邮件通知
rule_notify_onmissingdaysnumber当流在 N 天内未运行时发送通知(0 = 禁用)
rule_notify_emailstring逗号分隔的通知收件人
descriptionstring该流的功能
tagsstring分类标签(也会从描述的 #hashtags 中自动提取)
businessImpactstringLow / Medium / High / Critical
businessJustificationstring该流存在的原因、它自动化了什么流程
businessValuestring业务价值说明
ownerTeamstring负责团队
ownerBusinessUnitstring业务部门
supportGroupstring支持升级组
supportEmailstring支持联系邮箱
criticalbool指定为业务关键
tierstringStandard 或 Premium
securitystring安全分类或备注

注意 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归档评分、生命周期管理
tierstring许可证审计(Standard 与 Premium)
monitor *bool此流是否正在被主动监控?
criticalbool业务关键 designation(可通过 update_store_flow 设置)
businessImpactstring合规分类
businessJustificationstring合规证明
ownerTeamstring归属责任
supportEmailstring升级联系人
rule_notify_onfailbool是否配置了失败告警?
rule_notify_onmissingdaysnumber是否配置了 SLA 监控?
rule_notify_emailstring告警接收人
descriptionstring文档完整性
tagsstring分类 — list_store_flows 仅显示从描述中提取的 hashtag;由 update_store_flow 写入的存储标签需要 get_store_flow 才能读回
runPeriodTotal *number活跃程度
runPeriodFailRate *number健康状态
runLastISO string上次运行时间戳
scannedISO string数据新鲜度
deletedbool生命周期跟踪
createdTime *ISO string归档评分(存在时长)
lastModifiedTime *ISO string归档评分(陈旧程度)
ownersJSON string孤立检测、归属审计 — 使用 json.loads() 解析
connectionsJSON string连接器审计、层级 — 使用 json.loads() 解析
complexityJSON string归档评分(简洁性) — 使用 json.loads() 解析
securityJSON string认证类型审计 — 使用 json.loads() 解析,包含 triggerRequestAuthenticationType
sharingTypestring过度共享检测(顶层,不在 security 内)
referencedResourcesJSON stringURL 审计 — 使用 json.loads() 解析

相关技能

  • flowstudio-power-automate-monitoring — 健康检查、失败率、清单(只读)
  • flowstudio-power-automate-mcp — 基础技能:连接设置、MCP 辅助工具、工具发现
  • flowstudio-power-automate-debug — 基于操作级输入/输出的深度诊断
  • flowstudio-power-automate-build — 构建和部署流定义

评论

支持 Markdown