test-auth
Skill486 starsChanged 8 months agoMITView on GitHub
Authenticate for Copilot Studio evaluation API and SDK chat. Caches a token that is shared across run-eval and chat-sdk skills. Run this before any eval or SDK chat workflow. Requires an App Registration with MakerOperations and Copilots.Invoke permissions.
In this repository30 other files it gives its agents.
- add-actionSkill
- add-adaptive-cardSkill
- add-generative-answersSkill
- add-global-variableSkill
- add-knowledgeSkill
- add-nodeSkill
- add-other-agentsSkill
- analyze-evalsSkill
- chat-directlineSkill
- chat-sdkSkill
- chat-with-agentSkill
- clone-agentSkill
- create-eval-setSkill
- create-evalSkill
- detect-modeSkill
- directline-chatSkill
- edit-actionSkill
- edit-agentSkill
- edit-triggersSkill
- int-patternsSkill
- int-project-contextSkill
- int-referenceSkill
- list-kindsSkill
- list-topicsSkill
- lookup-schemaSkill
- manage-agentSkill
- new-topicSkill
- run-evalSkill
- run-tests-kitSkill
- validateSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Ask the user for their App Registration Client ID and show them all of the following requirements in your message:
- Distinctive: line 47
If the user doesn't have one, guide them:
- Distinctive: line 64
Run the auth command (opens a browser — no device code needed):
- Distinctive: line 70
If successful, you'll see:
- Very specific: line 84
Run security delete-generic-password -s "copilot-studio-cli" -a "test-agent" to clear the macOS Keychain entry
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test Agent Authentication
Authenticate with the Power Platform API for evaluation and SDK chat workflows.
This caches a token in the "test-agent" slot that is shared by run-eval and chat-sdk.
Step 1: Find the workspace
Locate the agent workspace (directory containing .mcs/conn.json):
Glob: **/agent.mcs.ymlThe conn.json provides the tenant ID automatically — no need to ask the user for it.
Step 2: Get the client ID
CRITICAL: You MUST present the FULL configuration checklist below when asking for the client ID. Do NOT omit any items — users frequently miss the redirect URI and public client settings, which causes auth failures.
Ask the user for their App Registration Client ID and show them all of the following requirements in your message:
What is your App Registration Client ID for the Evaluation API?
Before sharing it, please verify your App Registration has all of these settings:
- Redirect URI: Under Authentication > Mobile and desktop applications > redirect URI set to
http://localhost- Public client: Under Authentication > Advanced settings > Allow public client flows set to Yes
- API permissions: Under API permissions, these delegated permissions on the Power Platform API:
CopilotStudio.MakerOperations.Read(list test sets, get results)CopilotStudio.MakerOperations.ReadWrite(start evaluation runs)CopilotStudio.Copilots.Invoke(SDK chat — send utterances to the agent)- Admin consent: Granted for the tenant (green checkmarks in the API permissions list)
Missing any of these will cause authentication to fail.
If the user doesn't have one, guide them:
How to create an App Registration:
- Go to Azure Portal > App Registrations
- Click New registration, name it (e.g., "Copilot Studio Eval")
- Under API permissions > Add a permission > APIs my organization uses > search Power Platform API
- Select Delegated permissions and add:
CopilotStudio.MakerOperations.ReadCopilotStudio.MakerOperations.ReadWriteCopilotStudio.Copilots.Invoke- Click Grant admin consent for the tenant
- Under Authentication > Add a platform > Mobile and desktop applications > set redirect URI to
http://localhost- Still in Authentication, scroll to Advanced settings and set Allow public client flows to Yes (required — without this the interactive browser login will fail with an AADSTS error)
- Copy the Application (client) ID from the Overview page
Step 3: Authenticate
Run the auth command (opens a browser — no device code needed):
node ${CLAUDE_SKILL_DIR}/../../scripts/eval-api.bundle.js auth --workspace <path> --client-id <id>If successful, you'll see:
{"status": "ok", "message": "Authentication successful. Token cached for subsequent commands."}Return the client ID and workspace path to the caller — they need these for subsequent run-eval and chat-sdk calls.
Troubleshooting
- HTTP 403 / InsufficientDelegatedPermissions: The app registration is missing required permissions. Guide the user through adding them (Step 2).
- AADSTS700016 / app not found in directory: The client ID doesn't exist in the agent's tenant. The app must be registered in the same tenant as the Copilot Studio environment (check
conn.json>AccountInfo.TenantId). - AADSTS7000218 / request body must contain client_secret or client_assertion: The app registration is not configured as a public client. Go to Authentication > Advanced settings > set Allow public client flows to Yes.
- SDK chat hangs after auth: The cached token may have stale permissions. Clear the cache and re-authenticate:
- Delete
~/.copilot-studio-cli/test-agent.cache.json - Run
security delete-generic-password -s "copilot-studio-cli" -a "test-agent"to clear the macOS Keychain entry - Re-run the auth command
- Delete
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

