以下範例查詢會針對 Azure Resource Graph 中的 PowerPlatformResources 表格執行。 它們涵蓋資源計數與分配、欄位發現、資源查詢以及連接器使用分析。 關於 Power Platform 庫存的概述,請參見 Power Platform 庫存。 關於結構與欄位參考,請參見 Power Platform 庫存結構參考。
如何執行這些查詢
你可以從 Azure Resource Graph 介面執行這些查詢中的任何一項。 如需逐步教學,請參閱以下快速入門指南:
- 使用 Azure 入口網站查詢資源圖形
- 使用 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
資源查詢
在租用戶中尋找單一 Agent
PowerPlatformResources
| where type == "microsoft.copilotstudio/agents"
| where name == "[Enter the agent's ID]"
Tip
你可以在查看客服員時,在 Copilot Studio 的網址中找到該客服人員的 ID,或在庫存表的 名稱 欄位中找到。
過去24小時內產生的物品
PowerPlatformResources
| extend properties = parse_json(properties)
| extend createdAt = todatetime(properties.createdAt)
| where createdAt >= ago(24h)
連接器查詢(預覽)
以下查詢分析連接器在連接器 清單(預覽)涵蓋的資源類型中的使用情況。 每個查詢都會對畫布應用程式、模型導向應用程式、雲端流程、Agent 流程、工作流程 Agent 流程和 Copilot Studio Agent 發出的 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