以下示例查询针对 Azure Resource Graph 中的 PowerPlatformResources 表运行。 它们涵盖资源计数和分布、字段发现、资源查找和连接器使用情况分析。 有关 Power Platform 清单的概述,请参阅 Power Platform 清单。 有关架构和字段参考,请参阅 Power Platform 清单架构参考。
如何运行这些查询
可以从Azure Resource Graph接口运行其中的任何查询。 有关分步说明,请参阅以下快速入门指南:
- 使用 Azure 门户运行 Resource Graph 查询
- 使用 Azure CLI 运行 Resource Graph 查询
- 使用 Azure PowerShell 运行 Resource Graph 查询
- 使用 REST API 运行 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。
使用工具对代理进行计数
显示使用 GitHub Copilot harness、Copilot 对话助手 harness 或标准 harness 创建的代理分类明细。
你可以在 Power Platform 管理中心的>Copilot Studio下的Harness列中查看代理的 harness。 该列只是用户界面列。 Harness 尚未作为代理元数据返回,因此此查询会根据清单返回的字段推导出 Harness:properties.isCLIAgent、properties.model 和 properties.createdIn。 当 properties.harness 字段变为可用时,可以改为直接查询它。 有关字段定义,请参阅Microsoft Copilot Studio代理清单架构。
PowerPlatformResources
| where type == "microsoft.copilotstudio/agents"
| extend properties = parse_json(properties)
| extend
isCLIAgent = tobool(properties.isCLIAgent),
model = tostring(properties.model),
createdIn = tostring(properties.createdIn)
| extend harness = case(
isCLIAgent == true, "GitHub Copilot",
model =~ "Microsoft 365 Copilot" or createdIn =~ "Microsoft 365 Copilot Agent Builder", "Copilot Chat",
"Standard")
| summarize agentCount = count() by harness
| order by agentCount desc
列出代理及其对应的 Harness
为每个代理及其配套框架返回一行记录,因此你可以查找并对单个代理执行操作,而不只是统计它们的数量。 取消对 where 这一行的注释,以便仅返回使用 GitHub Copilot harness 构建的代理。
PowerPlatformResources
| where type == "microsoft.copilotstudio/agents"
| extend properties = parse_json(properties)
| extend
isCLIAgent = tobool(properties.isCLIAgent),
model = tostring(properties.model),
createdIn = tostring(properties.createdIn)
| extend harness = case(
isCLIAgent == true, "GitHub Copilot",
model =~ "Microsoft 365 Copilot" or createdIn =~ "Microsoft 365 Copilot Agent Builder", "Copilot Chat",
"Standard")
//| where harness == "GitHub Copilot"
| project agentName = tostring(properties.displayName),
agentId = name,
harness,
environmentId = tostring(properties.environmentId),
ownerId = tostring(properties.ownerId),
createdAt = todatetime(properties.createdAt)
| order by harness asc, createdAt desc
在过去 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