Query di esempio per l'inventario di Power Platform

Le query di esempio seguenti vengono eseguite sulla tabella PowerPlatformResources in Azure Resource Graph. Vengono trattati il conteggio e la distribuzione delle risorse, l'individuazione dei campi, le ricerche delle risorse e l'analisi dell'utilizzo del connettore. Per una panoramica dell'inventario di Power Platform, vedere Inventario di Power Platform. Per informazioni di riferimento sullo schema e sul campo, vedere Informazioni di riferimento sullo schema di inventario di Power Platform.

Come eseguire queste query

È possibile eseguire una di queste query dalle interfacce Azure Resource Graph. Per istruzioni dettagliate, vedere le guide introduttive seguenti:

Conteggi e distribuzione

Conteggio totale di tutte le risorse

PowerPlatformResources
| count

Conteggi totali per tipo di risorsa

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

Conteggi in base all'ambiente

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

Conteggi per area geografica

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

Proprietari principali per numero di elementi

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

Ricerche di risorse

Trova un singolo agente nel tenant

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

Tip

È possibile trovare l'ID dell'agente nell'URL di Copilot Studio quando si visualizza l'agente o nella colonna Nome della tabella di inventario.

Contare gli agenti tramite cablaggio

Mostra una ripartizione degli agenti creati con GitHub Copilot harness, Copilot Chat harness o Standard harness.

È possibile visualizzare l'imbracatura di un agente nella colonna Harness nell'interfaccia di amministrazione di Power Platform, in Gestisci>Copilot Studio. La colonna è solo una colonna dell'interfaccia utente. Harness non viene ancora restituito come metadati dell'agente, quindi questa query la deriva dai campi restituiti dall'inventario: properties.isCLIAgent, properties.modele properties.createdIn. Quando il properties.harness campo diventa disponibile, è possibile eseguirne una query direttamente. Per le definizioni dei campi, consultare Microsoft Copilot Studio schema di inventario degli agenti.

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

Elenca gli agenti con la loro imbracatura

Restituisce una riga per ogni agente con il relativo harness, in modo da poter individuare e intervenire sui singoli agenti anziché limitarsi a contarli. Rimuovere il commento dalla riga where per ottenere solo gli agenti creati con cablaggio GitHub Copilot.

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

Elementi creati nelle ultime 24 ore

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

Power Pages query (anteprima)

Power Pages le query usano il microsoft.powerpages/sites tipo di risorsa. L'inventario di Power Pages è disponibile solo per amministratori globali, amministratori di Power Platform e amministratori Dynamics 365.

Elencare i siti Power Pages

Questa query restituisce un inventario a livello di tenant dei siti Power Pages con il relativo ambiente, proprietario e le date di creazione e modifica.

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

Conteggio dei siti Power Pages per ambiente

Questa query mostra quali ambienti contengono il maggior numero di siti 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

Conteggio siti Power Pages per proprietario

Questa query mostra i proprietari associati al maggior numero di siti Power Pages per supportare le revisioni di proprietà e la pianificazione della continuità aziendale.

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

Siti Power Pages con accesso anonimo abilitato

Questa query trova siti i cui metadati di inventario indicano che è consentito l'accesso anonimo.

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

Siti di Power Pages creati di recente

Questa query restituisce i siti creati negli ultimi 30 giorni. Regolare l'intervallo in base alle esigenze.

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

Siti Power Pages con domini personalizzati

Questa query restituisce siti i cui metadati di inventario includono un URL del sito personalizzato.

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 con altre risorse di Power Platform

Questa query riepiloga i conteggi delle risorse per tipo e ambiente in Power Platform, inclusi i siti Power Pages. I record senza ID ambiente vengono esclusi.

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

Interrogazioni del connettore

Le query seguenti analizzano l'utilizzo dei connettori nei tipi di risorse coperti da Connector inventory. Ogni query opera sull'array properties.powerPlatformConnectors generato dalle app canvas, dalle app basate su modello, dalle app compilate nel runtime gestito di Copilot, dai flussi cloud, dai flussi degli agenti, dai flussi degli agenti del flusso di lavoro, dagli agenti di Copilot Studio sull'harness Standard o sull'harness GitHub Copilot e dagli agenti creati in Microsoft 365 Copilot Agent Builder. Le app create nel runtime gestito di Copilot usano il tipo microsoft.powerapps/apps con il sottotipo microsoftApp. Le query escludono app di App Builder, che usano lo stesso tipo ma non generano dati del connettore.

Principali connettori usati tra le risorse di Power Platform

Elenca i connettori usati dalle risorse più distinte. Utile per comprendere quali connettori sono più adottati all'interno del tenant.

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

Distribuzione del numero di connettori per risorsa

Mostra il numero di risorse che usano 0, 1, 2 o più connettori. Utile per individuare gli outlier di complessità.

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

Trovare tutte le risorse che usano un connettore specifico

Sostituire shared_sharepointonline con il connettore che si vuole cercare. Questa query è utile per l'analisi dell'impatto quando un connettore presenta un problema noto, è deprecato o richiede nuove licenze.

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

Utilizzo del connettore per ambiente

Elenca ogni connettore usato in ogni ambiente, con il numero di risorse distinte che lo usano. Questo elenco è utile per comprendere i modelli di adozione e orientare le decisioni relative ai criteri 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