Edit

Power Platform inventory sample queries

The following sample queries run against the PowerPlatformResources table in Azure Resource Graph. They cover resource counting and distribution, field discovery, resource lookups, and connector usage analysis. For an overview of Power Platform inventory, see Power Platform inventory. For the schema and field reference, see Power Platform inventory schema reference.

How to run these queries

You can run any of these queries from the Azure Resource Graph interfaces. For step-by-step instructions, see the following quickstart guides:

Counts and distribution

Total count of all resources

PowerPlatformResources
| count

Total counts by resource type

PowerPlatformResources
| summarize resourceCount = count() by type
| order by resourceCount

Counts by environment

PowerPlatformResources
| extend properties = parse_json(properties)
| extend environmentId = tostring(properties.environmentId)
| summarize resourceCount = count() by environmentId
| order by resourceCount desc

Counts by region

PowerPlatformResources
| summarize resourceCount = count() by location
| order by resourceCount desc

Top owners by item count

PowerPlatformResources
| extend properties = parse_json(properties)
| extend ownerId = tostring(properties.ownerId)
| summarize resourceCount = count() by ownerId
| order by resourceCount desc

Resource lookups

Find a single agent in the tenant

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

Tip

You can find the agent's ID in the Copilot Studio URL when viewing the agent, or in the Name column of the inventory table.

Count agents by harness

Shows a breakdown of agents created with the GitHub Copilot harness, Copilot Chat harness, or Standard harness.

You can see an agent's harness in the Harness column in the Power Platform admin center, under Manage > Copilot Studio. That column is a user interface column only. Harness isn't yet returned as agent metadata, so this query derives it from the fields the inventory returns: properties.isCLIAgent, properties.model, and properties.createdIn. When the properties.harness field becomes available, you can query it directly instead. For the field definitions, see Microsoft Copilot Studio Agent inventory schema.

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

List agents with their harness

Returns one row per agent with its harness, so you can find and act on individual agents rather than only counting them. Uncomment the where line to return only the agents built with the GitHub 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

Items created in the past 24 hours

PowerPlatformResources
| extend properties = parse_json(properties)
| extend createdAt = todatetime(properties.createdAt)
| where createdAt >= ago(24h)

Connector queries (preview)

The following queries analyze connector usage across the resource types covered by Connector inventory (preview). Each query operates on the properties.powerPlatformConnectors array emitted by canvas apps, model-driven apps, cloud flows, agent flows, workflow agent flows, and Copilot Studio agents.

Top connectors used across Power Platform resources

Lists the connectors used by the most distinct resources. Useful for understanding which connectors dominate adoption across the tenant.

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

Distribution of connector count per resource

Shows how many resources use 0, 1, 2, or more connectors. Useful for spotting complexity outliers.

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

Find all resources that use a specific connector

Replace shared_sharepointonline with the connector you want to search for. This query is useful for impact analysis when a connector has a known issue, is being deprecated, or requires new licensing.

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

Connector usage by environment

Lists every connector used in every environment, with the count of distinct resources that use it. This list is useful for understanding adoption patterns and informing DLP policy decisions.

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