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

リソース参照

テナント内の 1 つのエージェントを検索する

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

Tip

エージェントの ID は、エージェントを表示するときに Copilot Studio の URL またはインベントリ テーブルの [名前] 列で確認できます。

ハーネスごとのエージェント数をカウントする

GitHub Copilot ハーネス、Copilot Chat ハーネス、または Standard ハーネスで作成されたエージェントの内訳を示します。

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

各エージェントとそのハーネスを一覧表示する

ハーネスを使用してエージェントごとに 1 行を返します。そのため、個々のエージェントだけをカウントするのではなく、個々のエージェントを検索して操作できます。 GitHub Copilot harness で構築されたエージェントのみが返されるように、where 行のコメントを解除してください。

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