test-auth
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.
- License 许可
- MIT
- 最近更新
- 2026-11-05
- Stars
- ★ 490
- Forks
- 102
01 前言 Front Matter
- agent
- copilot-studio-test
- context
- fork
- description
- 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.
- allowed-tools
- Bash(node *eval-api.bundle.js auth *), Read, Glob
- user-invocable
- false
03 SKILL.md 正文
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.yml
The 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
04 同仓库更多 Skills
validate
Validate Copilot Studio agent YAML files using the LSP binary's full diagnostics (YAML structure, Power Fx, schema, cross-file references). Use when the user asks to check, validate, or verify YAML files.
run-tests-kit
Run a batch test suite via the Copilot Studio Kit (Dataverse API). Uses the Power CAT Copilot Studio Kit to execute test cases against a published agent and produces pass/fail results with latencies. Requires the Kit installed in the environment, an App Registration with Dataverse permissions, and a published agent.
run-eval
Run evaluations against a Copilot Studio agent via the Power Platform Evaluation API. Works on DRAFT agents — no publish step required. Lists test sets, starts a run, polls until complete, fetches results, and proposes YAML fixes for failures. Use when the user wants to test agent changes without publishing.
new-topic
Create a new Copilot Studio topic YAML file. Use when the user asks to create a new topic, conversation flow, or dialog for their agent.
manage-agent
Push/pull Copilot Studio agent content via the VS Code extension's LanguageServerHost LSP binary. Handles authentication (interactive browser login for push/pull, device code flow for chat token), sync push, sync pull, clone, and diff operations.
lookup-schema
Look up Copilot Studio YAML schema definitions. Use when the user asks about schema structure, element properties, or how to use a specific YAML kind.