以下示例查询针对 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。
按框架统计智能体
显示使用Microsoft Copilot线束、Copilot 对话助手线束或标准线束创建的代理的细分。
您可以在 Power Platform 管理中心的框架列中查看智能体的框架,该列位于管理>Copilot Studio 下。 该列只是用户界面列。 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
按框架列出智能体
为每个智能体返回一行数据及其所属框架,以便您不仅能统计智能体数量,还能查找并针对单个智能体采取操作。 取消注释该where行以仅返回使用 Microsoft 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)
Power Pages查询(预览版)
Power Pages查询使用microsoft.powerpages/sites资源类型。 Power Pages清单仅适用于全局管理员、Power Platform 管理员和Dynamics 365管理员。
列出Power Pages网站
此查询返回租户范围的Power Pages网站清单,其中包含其环境、所有者和创建和修改日期。
PowerPlatformResources
| where type =~ "microsoft.powerpages/sites"
| extend properties = parse_json(properties)
| project siteName = tostring(properties.displayName),
siteId = name,
environmentId = tostring(properties.environmentId),
ownerId = tostring(properties.ownerId),
createdOn = todatetime(properties.createdAt),
lastModifiedOn = todatetime(properties.lastModifiedAt)
| order by siteName asc
按环境统计Power Pages站点数
此查询显示哪些环境包含最多Power Pages站点。
PowerPlatformResources
| where type =~ "microsoft.powerpages/sites"
| extend properties = parse_json(properties)
| extend environmentId = tostring(properties.environmentId)
| summarize siteCount = count() by environmentId
| order by siteCount desc
按所有者统计Power Pages网站
此查询显示与最多Power Pages网站关联的所有者,以支持所有权评审和业务连续性规划。
PowerPlatformResources
| where type =~ "microsoft.powerpages/sites"
| extend properties = parse_json(properties)
| extend ownerId = tostring(properties.ownerId)
| summarize siteCount = count() by ownerId
| order by siteCount desc
启用了匿名访问的Power Pages网站
此查询查找其清单元数据指示允许匿名访问的网站。
PowerPlatformResources
| where type =~ "microsoft.powerpages/sites"
| extend properties = parse_json(properties)
| extend anonymousAccessEnabled = tobool(properties.anonymousAccessAllowed)
| where anonymousAccessEnabled == true
| project siteName = tostring(properties.displayName),
siteId = name,
environmentId = tostring(properties.environmentId),
websiteUrl = tostring(properties.siteUrl)
| order by siteName asc
最近创建的Power Pages网站
此查询返回在过去 30 天内创建的站点。 根据需要调整间隔。
PowerPlatformResources
| where type =~ "microsoft.powerpages/sites"
| extend properties = parse_json(properties)
| extend createdOn = todatetime(properties.createdAt)
| where createdOn >= ago(30d)
| project siteName = tostring(properties.displayName),
siteId = name,
environmentId = tostring(properties.environmentId),
ownerId = tostring(properties.ownerId),
createdOn
| order by createdOn desc
使用自定义域名的 Power Pages 网站
此查询返回其清单元数据包括自定义网站 URL 的网站。
PowerPlatformResources
| where type =~ "microsoft.powerpages/sites"
| extend properties = parse_json(properties)
| extend customDomain = tostring(properties.customSiteUrl)
| where isnotempty(customDomain)
| project siteName = tostring(properties.displayName),
siteId = name,
environmentId = tostring(properties.environmentId),
websiteUrl = tostring(properties.siteUrl),
customDomain
| order by siteName asc
Power Pages 与其他 Power Platform 资源
此查询按类型和环境汇总了 Power Platform 中的资源计数,包括Power Pages站点。 不包括没有环境 ID 的记录。
PowerPlatformResources
| extend properties = parse_json(properties)
| extend environmentId = tostring(properties.environmentId)
| where isnotempty(environmentId)
| summarize resourceCount = count() by environmentId, type
| order by environmentId asc, resourceCount desc
连接器查询
以下查询分析 连接器清单涵盖的资源类型的连接器使用情况。 每个查询都对以下对象发出的 properties.powerPlatformConnectors 数组进行操作:画布应用、模型驱动应用、在 Copilot 托管运行时中构建的应用、云流、代理流、工作流代理流、在 Standard harness 或 Microsoft Copilot harness 上的 Copilot Studio 代理,以及在 智能 Microsoft 365 Copilot 副驾驶® Agent Builder 中创建的代理。 在 Copilot 托管运行时中构建的应用使用 microsoft.powerapps/apps 类型和 microsoftApp 子类型。 这些查询不包括 App Builder 应用,这些应用使用相同的类型,但不输出连接器数据。
整个 Power Platform 资源中使用的最常用连接器
列出最不同的资源使用的连接器。 有助于了解哪些连接器主导整个租户的采用。
PowerPlatformResources
| where type in (
"microsoft.powerapps/canvasapps",
"microsoft.powerapps/modeldrivenapps",
"microsoft.powerapps/apps",
"microsoft.powerautomate/cloudflows",
"microsoft.powerautomate/agentflows",
"microsoft.powerautomate/m365agentflows",
"microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| where type != "microsoft.powerapps/apps" or tostring(properties.subType) == "microsoftApp"
| 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.powerapps/apps",
"microsoft.powerautomate/cloudflows",
"microsoft.powerautomate/agentflows",
"microsoft.powerautomate/m365agentflows",
"microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| where type != "microsoft.powerapps/apps" or tostring(properties.subType) == "microsoftApp"
| 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.powerapps/apps",
"microsoft.powerautomate/cloudflows",
"microsoft.powerautomate/agentflows",
"microsoft.powerautomate/m365agentflows",
"microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| where type != "microsoft.powerapps/apps" or tostring(properties.subType) == "microsoftApp"
| 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.powerapps/apps",
"microsoft.powerautomate/cloudflows",
"microsoft.powerautomate/agentflows",
"microsoft.powerautomate/m365agentflows",
"microsoft.copilotstudio/agents")
| extend properties = parse_json(properties)
| where type != "microsoft.powerapps/apps" or tostring(properties.subType) == "microsoftApp"
| 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