以下範例查詢會針對 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
資源查詢
在租用戶中尋找單一 Agent
PowerPlatformResources
| where type == "microsoft.copilotstudio/agents"
| where name == "[Enter the agent's ID]"
Tip
你可以在查看客服員時,在 Copilot Studio 的網址中找到該客服人員的 ID,或在庫存表的 名稱 欄位中找到。
依執行架構計算 Agent 數目
顯示使用 Microsoft Copilot 線束、Copilot Chat 線束或標準線束所建立的代理程式分類。
您可以在 Power Platform 系統管理中心的執行架構資料行中,於管理>Copilot Studio 底下查看 Agent 的執行架構。 那欄只是使用者介面欄位。 執行架構尚未以 Agent 中繼資料的形式傳回,因此這個查詢會從清查傳回的欄位推導出來: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
列出 Agent 及其執行架構
每個 Agent 傳回一個資料列並附上其執行架構,讓您可以找出並處理個別 Agent,而不只是計算數量。 取消註解 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 網站
此查詢會回傳那些庫存中繼資料包含自訂網站網址的網站。
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 管理執行環境內建的應用程式、雲端流程、代理流程、工作流程代理流程、標準架構或 Microsoft Copilot 架構上的 Copilot Studio 代理程式,以及在 Microsoft 365 Copilot 代理建立器中建立的代理程式所發出的陣列。 用 Copilot 管理執行時建置的應用程式會使用 microsoft.powerapps/apps type 搭配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