Skip to content

Instantly share code, notes, and snippets.

@joerodgers
joerodgers / powerplatform-dashboard-SKILL.md
Last active June 24, 2026 17:37
Copilot Cowork Power Platform Analytics Dashboard Generation Skill

name: powerplatform-dashboard description: >- Builds a single self-contained interactive HTML dashboard analyzing a Power Platform tenant from two exports — an environment report and an agent inventory. Use when the user says "build a Power Platform dashboard", "analyze my Power Platform environments", "Power Platform environment + agent report", "Copilot Studio / Agent Builder agent analytics", "dashboard from my environment and agent exports", or attaches a PowerPlatformEnvironmentReport plus an agent-inventory file and asks for analytics. Do NOT use for generic spreadsheet charts, non-Power-Platform data, building Power BI

@joerodgers
joerodgers / Get-DeclarativeAgentMetadata.ps1
Last active June 18, 2026 21:14
Uses the agent inventory API to export the metadata about all declarative agents in the tenant to a csv file.
#requires -modules "Microsoft.Graph.Authentication"
# the agent inventory API is gated behind the A365 license, so user identity needs an A365 license assigned.
Connect-MgGraph -Scopes "CopilotPackages.Read.All" -ClientId $env:O365_CLIENTID
$uri = "beta/copilot/admin/catalog/packages"
$declarativeAgents = do
{
#requires -modules "Microsoft.PowerApps.Administration.PowerShell"
function Register-PowerPlatformAdminServicePrincipal
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[Guid]
$ClientId
@joerodgers
joerodgers / Get-AgentInventory.ps1
Last active May 7, 2026 16:56
Uses a resource query to pull back all Copilot Studio and Agent Builder agents in the tenant.
#requires -modules "Microsoft.PowerApps.Administration.PowerShell"
function Get-AgentInventory
{
[CmdletBinding()]
param
(
)
begin
#requires -modules "Microsoft.Graph.Authentication"
# permissions: Microsoft Graph > Application > AgentInstance.Read.All
Connect-MgGraph -ClientId $env:CDX_CLIENTID -CertificateThumbprint $env:CDX_THUMBPRINT -TenantId $env:CDX_TENANTID
$uri = "/beta/agentRegistry/agentInstances"
$mcsAgents = do
{
@joerodgers
joerodgers / Get-PowerPlatformEnvironmentReport.ps1
Last active June 5, 2026 18:05
Creates a report mapping Power Platform environments to billing policies. Includes PAYGO details of each billing policy.
#requires -modules "Microsoft.PowerApps.Administration.PowerShell"
function Get-BillingPolicyEnvironmentMap
{
[CmdletBinding()]
param
(
)
begin
@joerodgers
joerodgers / script.csx
Created March 17, 2026 19:39
Sample Power Platform custom connector script to reformat an access Entra token to support token signature validation.
using Newtonsoft.Json;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public class Script : ScriptBase
{
public override async Task<HttpResponseMessage> ExecuteAsync()
{
// Check if the operation ID matches what is specified in the OpenAPI definition of the connector
@joerodgers
joerodgers / Test-EntraAccessTokenSignature.ps1
Last active March 15, 2026 09:30
Validates the signature of an Entra access token
function ConvertFrom-Base64Url
{
param
(
[Parameter(Mandatory = $true)]
[string]
$InputString,
[Parameter(Mandatory = $false,ParameterSetName="AsString")]
@joerodgers
joerodgers / New-PublicClientApplicationAccessToken.ps1
Created March 11, 2026 16:56
Uses Microsoft.Identity.Client assembly loaded via the "Microsoft.PowerApps.Administration.PowerShell" module to generate an Entra access token
#requires -modules "Microsoft.PowerApps.Administration.PowerShell"
$clientId = $env:CDX_CLIENTID
$tenantId = $env:CDX_TENANTID
[string[]]$scopes = "https://api.powerplatform.com/.default", "openid", "profile offline_access"
$pca = [Microsoft.Identity.Client.PublicClientApplicationBuilder]::Create($clientId).WithAuthority( "https://login.microsoftonline.com/$tenantId", $true).
WithRedirectUri( "http://localhost" ).
Build()
@joerodgers
joerodgers / Invoke-GraphThreatHuntingQuery.ps1
Last active March 9, 2026 15:10
Example how to leverage Microsoft 365 Defender Graph Threat Hunting endpoint to query for Copilot Interactions in an tenant.
#requires -Modules "Microsoft.Graph.Authentication"
function Invoke-GraphThreatHuntingQuery
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
$HuntingQuery,