Power Platform 清单示例查询

以下示例查询针对 Azure Resource Graph 中的 PowerPlatformResources 表运行。 它们涵盖资源计数和分布、字段发现、资源查找和连接器使用情况分析。 有关 Power Platform 清单的概述,请参阅 Power Platform 清单。 有关架构和字段参考,请参阅 Power Platform 清单架构参考

如何运行这些查询

可以从Azure Resource Graph接口运行其中的任何查询。 有关分步说明,请参阅以下快速入门指南:

计数和分布

所有资源的总数

PowerPlatformResources
| count

按资源类型统计的总计数

PowerPlatformResources
| summarize resourceCount = count() by type
| order by resourceCount

按环境计数

PowerPlatformResources
| extend properties = parse_json(properties)
| extend environmentId = tostring(properties.environmentId)
| summarize resourceCount = count() by environmentId
| order by resourceCount desc

按区域计数

PowerPlatformResources
| summarize resourceCount = count() by location
| order by resourceCount desc

按项目数量排名靠前的所有者

PowerPlatformResources
| extend properties = parse_json(properties)
| extend ownerId = tostring(properties.ownerId)
| summarize resourceCount = count() by ownerId
| order by resourceCount desc

资源查找

在租户中查找单个代理

PowerPlatformResources
| where type == "microsoft.copilotstudio/agents"
| where name == "[Enter the agent's ID]"

Tip

查看代理时或在清单表的 “名称 ”列中,可以在 Copilot Studio URL 中找到代理的 ID。

在过去 24 小时内创建的项目

PowerPlatformResources
| extend properties = parse_json(properties)
| extend createdAt = todatetime(properties.createdAt)
| where createdAt >= ago(24h)

连接器查询(预览版)

以下查询分析连接器清单涵盖的资源类型的连接器使用情况(预览版)。 每个查询都对由画布应用、模型驱动应用、云流、代理流、工作流代理流和 Copilot Studio 代理输出的 properties.powerPlatformConnectors 数组执行操作。

整个 Power Platform 资源中使用的最常用连接器

列出最不同的资源使用的连接器。 有助于了解哪些连接器主导整个租户的采用。

PowerPlatformResources
| where type in (
    "microsoft.powerapps/canvasapps",
    "microsoft.powerapps/modeldrivenapps",
    "microsoft.powerautomate/cloudflows",
    "microsoft.powerautomate/agentflows",
    "microsoft.powerautomate/m365agentflows",
    "microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| mv-expand connector = properties.powerPlatformConnectors
| extend connectorId = tostring(connector.connectorId)
| where isnotempty(connectorId)
| summarize ResourceCount = dcount(name) by connectorId
| order by ResourceCount desc
| take 10

每个资源的连接器计数分布

显示有多少资源使用 0、1、2 或更多连接器。 有助于识别复杂度异常值。

PowerPlatformResources
| where type in (
    "microsoft.powerapps/canvasapps",
    "microsoft.powerapps/modeldrivenapps",
    "microsoft.powerautomate/cloudflows",
    "microsoft.powerautomate/agentflows",
    "microsoft.powerautomate/m365agentflows",
    "microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| extend connectorCount = array_length(properties.powerPlatformConnectors)
| summarize ResourceCount = count() by toint(connectorCount)
| order by connectorCount asc

查找使用特定连接器的所有资源

用您要搜索的连接器替换 shared_sharepointonline。 当连接器存在已知问题、已弃用或需要新许可时,此查询对于影响分析非常有用。

PowerPlatformResources
| where type in (
    "microsoft.powerapps/canvasapps",
    "microsoft.powerapps/modeldrivenapps",
    "microsoft.powerautomate/cloudflows",
    "microsoft.powerautomate/agentflows",
    "microsoft.powerautomate/m365agentflows",
    "microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| mv-expand connector = properties.powerPlatformConnectors
| where tostring(connector.connectorId) == "shared_sharepointonline"
| project resourceName = tostring(properties.displayName),
          resourceId = name,
          resourceType = type,
          environmentId = tostring(properties.environmentId),
          operationsUsed = connector.operations

按环境排序的连接器使用情况

列出每个环境中使用的每个连接器,以及使用该连接器的不同资源数量。 此列表有助于了解采用模式并通知 DLP 策略决策。

PowerPlatformResources
| where type in (
    "microsoft.powerapps/canvasapps",
    "microsoft.powerapps/modeldrivenapps",
    "microsoft.powerautomate/cloudflows",
    "microsoft.powerautomate/agentflows",
    "microsoft.powerautomate/m365agentflows",
    "microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| mv-expand connector = properties.powerPlatformConnectors
| extend connectorId = tostring(connector.connectorId)
| where isnotempty(connectorId)
| extend environmentId = tostring(properties.environmentId)
| summarize ResourceCount = dcount(name) by environmentId, connectorId
| order by environmentId asc, ResourceCount desc