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)

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 Platform リソースを使用した Power Pages

このクエリでは、Power Pages サイトを含め、Power Platform 全体の種類と環境別にリソース数を集計します。 環境 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

コネクター クエリ

次のクエリは、 コネクタ インベントリの対象となるリソースの種類全体でコネクタの使用状況を分析します。 各クエリは、キャンバス アプリ、モデル駆動型アプリ、Copilotマネージド ランタイムに組み込まれたアプリ、クラウド フロー、エージェント フロー、ワークフロー エージェント フロー、Standard ハーネスまたは GitHub Copilot ハーネス上のCopilot Studio エージェント、および Microsoft 365 Copilot Agent Builder で作成されたエージェントによって出力されるproperties.powerPlatformConnectors配列で動作します。 マネージド ランタイムCopilot組み込まれているアプリでは、microsoftApp サブタイプと共にmicrosoft.powerapps/apps型が使用されます。 クエリでは、同じ種類を使用するがコネクタ データを出力しない 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