Debug Agent

SkillMonitoring & ops

Diagnose a pipeline failure or customer issue end-to-end. Accepts a log path, error text, ADO work item ID, or GitHub issue URL.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Debug Agent skill

What this skill tells your AI

The instructions your AI receives, as published by microsoft/powerplatform-build-tools in .claude/skills/debug-agent/SKILL.md and read by ahel’s review.

Diagnose a pipeline failure or customer issue end-to-end. Accepts a log file path, pasted error text, ADO work item ID, or GitHub issue URL. Determines ownership, resolves if PPBT-owned, or produces a precise triage package for the right team.

Invoke as: /debug-agent <log-file-path | error-text | issue-url | ado-id>

Works autonomously through all steps. One exception: pauses to request pipeline logs if they are referenced in an ICM/work item but not yet provided — log evidence is required before classifying the failure layer.


Step 0 — Ingest the input

Determine input type:

  • File path (.txt, .log, or similar): read it with the Read tool
  • ADO work item (dev.azure.com/... URL or bare integer): az boards work-item show --id <id> 2>&1
  • GitHub issue (github.com/.../issues/<n>): gh issue view <n> --comments 2>&1
  • Pasted text: use as-is

Extract and print:

Input summary:
- Type: <file | ado | github | text>
- Task/tool identified: <name from log header, or "unknown">
- Error snippet: <first clear error line, or "none found">
- Timestamp range: <start → end>
- Deployment result: <SUCCESS | FAILED | unknown>

Step 0b — Check for missing logs

If input is an ICM or ADO work item AND any of the following are true:

  • Custom field LogsAttached = "Yes"
  • Description mentions "logs attached" or "see attachment"
  • Issue cannot be diagnosed from text alone (no error snippet, no pac CLI output visible)

AND no log file path or log content was provided by the user:

STOP. Prompt the user:

Pipeline logs are attached to this ICM/work item but aren't accessible via API.
Please download the logs from the portal and provide the folder path.
Example: C:\Users\<you>\Downloads\

Once you share the path, I'll read the logs and continue the analysis from Step 1.

Do not proceed to Step 1 until log content is available. Do NOT classify the failure layer, assign ownership, or draw conclusions based solely on the ICM title or description — log evidence is mandatory. If the user confirms no logs exist or they are unavailable, continue with Confidence: low noted throughout.


Step 1 — Verify PPBT is involved

ADO (Azure DevOps) — PPBT task identifiers

Every PPBT v2 task follows the pattern: microsoft-IsvExpTools.PowerPlatform-BuildTools.<task-id>.<TaskClass>@2

Display NameTask ID (in YAML/log)Task Class
Power Platform Tool Installertool-installerPowerPlatformToolInstaller@2
Power Platform WhoAmIwhoamiPowerPlatformWhoAmi@2
Power Platform CheckercheckerPowerPlatformChecker@2
Power Platform Import Solutionimport-solutionPowerPlatformImportSolution@2
Power Platform Export Solutionexport-solutionPowerPlatformExportSolution@2
Power Platform Unpack Solutionunpack-solutionPowerPlatformUnpackSolution@2
Power Platform Pack Solutionpack-solutionPowerPlatformPackSolution@2
Power Platform Delete Solutiondelete-solutionPowerPlatformDeleteSolution@2
Power Platform Add Solution Componentadd-solution-componentPowerPlatformAddSolutionComponent@2
Power Platform Apply Solution Upgradeapply-solution-upgradePowerPlatformApplySolutionUpgrade@2
Power Platform Publish Customizationspublish-customizationsPowerPlatformPublishCustomizations@2
Power Platform Set Solution Versionset-solution-versionPowerPlatformSetSolutionVersion@2
Power Platform Set Connection Variablesset-connection-variablesPowerPlatformSetConnectionVariables@2
Power Platform Deploy Packagedeploy-packagePowerPlatformDeployPackage@2
Power Platform Create Environmentcreate-environmentPowerPlatformCreateEnvironment@2
Power Platform Delete Environmentdelete-environmentPowerPlatformDeleteEnvironment@2
Power Platform Assign Userassign-userPowerPlatformAssignUser@2
Power Platform Reset Environmentreset-environmentPowerPlatformResetEnvironment@2
Power Platform Backup Environmentbackup-environmentPowerPlatformBackupEnvironment@2
Power Platform Copy Environmentcopy-environmentPowerPlatformCopyEnvironment@2
Power Platform Restore Environmentrestore-environmentPowerPlatformRestoreEnvironment@2
Export Dataverse Dataexport-dataPowerPlatformExportData@2
Import Dataverse Dataimport-dataPowerPlatformImportData@2
Power Platform Download PAPortaldownload-paportalPowerPlatformDownloadPaportal@2
Power Platform Upload PAPortalupload-paportalPowerPlatformUploadPaportal@2

PPBT signals (any one is sufficient):

  • Task class matches any entry in the table above
  • Author is Microsoft (not Wael Hamze or other community authors)
  • Log contains POWERPLATFORMTOOLS_PACCLIPATH or PP_TOOLS_AUTOMATION_AGENT
  • pac CLI invoked: lines containing pac solution, pac auth, pac env, pac admin, pac package
  • BuildTools.EnvironmentUrl pipeline variable present

GitHub Actions — PPBT action identifiers

All PPBT GitHub Actions use: microsoft/powerplatform-actions/<action-name>@v1

Actionuses: value
Install Power Platform Toolsmicrosoft/powerplatform-actions/actions-install@v1
WhoAmImicrosoft/powerplatform-actions/whoAmI@v1
Import Solutionmicrosoft/powerplatform-actions/import-solution@v1
Export Solutionmicrosoft/powerplatform-actions/export-solution@v1
Unpack Solutionmicrosoft/powerplatform-actions/unpack-solution@v1
Pack Solutionmicrosoft/powerplatform-actions/pack-solution@v1
Publish Customizationsmicrosoft/powerplatform-actions/publish-solution@v1
Clone Solutionmicrosoft/powerplatform-actions/clone-solution@v1
Check Solutionmicrosoft/powerplatform-actions/check-solution@v1
Upgrade Solutionmicrosoft/powerplatform-actions/upgrade-solution@v1
Deploy Packagemicrosoft/powerplatform-actions/deploy-package@v1
Upload PAPortalmicrosoft/powerplatform-actions/upload-paportal@v1
Catalog Installmicrosoft/powerplatform-actions/install@v1
Catalog Submitmicrosoft/powerplatform-actions/submit@v1
Catalog Statusmicrosoft/powerplatform-actions/status@v1

Not-PPBT signals — deflect immediately:

  • Author: Wael Hamze → CRM Build Tools (community)
  • Microsoft.Xrm.Tooling.* PowerShell → old XRM Tooling
  • PackageDeployer PowerShell task (v12.x) → Wael Hamze legacy tooling
  • Task version @v1 and no microsoft/powerplatform-actions prefix → unrelated action

If not PPBT: skip to Step 5 (non-PPBT triage) immediately.


Step 2 — Identify the failing task and classify the layer

2a — Map the failing task to its inputs

Use the tables below to check whether required inputs are present in the log or YAML.

Helper tasks

Tool Installer (tool-installer) — must be FIRST task in every pipeline/workflow

  • No required inputs beyond defaults
  • Critical: if missing → all other tasks fail with "pac.exe not found" or POWERPLATFORMTOOLS_PACCLIPATH not set
  • Optional: AddToolsToPath: true (adds pac to PATH for script tasks)

WhoAmI (whoami / whoAmI)

  • Required: authenticationType + one of PowerPlatformEnvironment or PowerPlatformSPN
  • GitHub: environment-url + auth credentials (user-name/password-secret OR app-id/client-secret/tenant-id)
  • Use: connectivity check early in pipeline — failure here = auth or network issue, not solution issue
Quality check

Checker (checker / check-solution)

  • Required: PowerPlatformSPN (SPN only — username/password NOT supported for checker)
  • Required: RuleSet GUID
  • Optional: UseDefaultPACheckerEndpoint (default true) — if false, must set CustomPACheckerEndpoint
  • Output: SARIF file as pipeline artifact (ArtifactDestinationName)
  • Common issue: checker fails for username/password connections — SPN required
Solution tasks

Import Solution (import-solution)

  • Required: service connection + SolutionInputFile
  • Key options: AsyncOperation: true (recommended for large solutions — avoids 4-min timeout), HoldingSolution (for upgrade pattern), UseDeploymentSettingsFile (for connection references + env vars)
  • Common issue: sync import times out on large solutions → set AsyncOperation: true, MaxAsyncWaitTime: 60
  • Common issue: connection references not set → use DeploymentSettingsFile

Export Solution (export-solution)

  • Required: service connection + SolutionName + SolutionOutputFile
  • Note: use solution Name not Display Name
  • Managed: true exports as managed

Apply Solution Upgrade (apply-solution-upgrade)

  • Required: service connection + SolutionName
  • Use after Import with HoldingSolution: true

Pack / Unpack Solution — local operations, no service connection needed

  • SolutionType: Managed | Unmanaged | Both

Set Solution Version (set-solution-version)

  • Required: service connection + SolutionName + SolutionVersionNumber
  • Tip: use $(Build.BuildId) as version number

Set Connection Variables (set-connection-variables)

  • Sets pipeline variables: BuildTools.TenantId, BuildTools.ApplicationId, BuildTools.ClientSecret, BuildTools.DataverseConnectionString
  • Username/password auth also requires ApplicationId and RedirectUri

Deploy Package (deploy-package)

  • Required: service connection + PackageFile (.dll)
  • GitHub Actions: Windows runner only (runs-on: windows-latest)
Environment management tasks

Create Environment (create-environment)

  • Required: DisplayName, LocationName, EnvironmentSku, CurrencyName, LanguageName, DomainName
  • Side effect: sets BuildTools.EnvironmentUrl pipeline variable — subsequent tasks use this automatically
  • Note: BuildTools.EnvironmentUrl overrides any service connection URL for downstream tasks

Copy Environment (copy-environment)

  • Required: TargetEnvironmentUrl
  • CopyType: FullCopy (data + metadata) or MinimalCopy (metadata only)

Restore Environment (restore-environment)

  • RestoreLatestBackup: true OR provide RestoreTimeStamp in mm/dd/yyyy hh:mm format

Export/Import Dataverse Data

  • Schema file created via Configuration Migration tool
  • Import accepts zip file or folder with data-schema.xml + data.xml
Power Pages tasks
  • download-paportal / upload-paportal: requires WebsiteId GUID, optional ModelVersion (1=standard, 2=enhanced data model)

2b — When is it a PPBT bug (this repo)?

PPBT owns exactly the boundary between the ADO/GitHub pipeline and cli-wrapper. A bug is PPBT's if the wrong value reaches cli-wrapper or no value reaches cli-wrapper when the user configured the pipeline correctly.

PPBT owns it — fix in this repo — when:

SymptomRoot causeFile to fix
Task input exists in task.json but is silently ignored / not passed to pacindex.ts doesn't read it via parameterMapsrc/tasks/<name>/index.ts
Task input works on Windows but breaks on Linux (path, binary location)CliLocator.ts platform logicsrc/host/CliLocator.ts
Wrong cloud instance sent to pac for a valid service connectionresolveCloudInstance() missing a cloud mappingsrc/params/auth/getCredentials.ts
BuildTools.EnvironmentUrl not set after create-environment runsindex.ts not calling tl.setVariablesrc/tasks/create-environment/index.ts
Service connection field (e.g. tenantId) extracted as null/undefinedgetCredentials.ts reading wrong endpoint fieldsrc/params/auth/getCredentials.ts
Environment URL fallback chain skips a valid sourcegetEnvironmentUrl.ts fallback order wrongsrc/params/auth/getEnvironmentUrl.ts
Tasks appear in wrong pipeline stage / wrong task GUIDsGUID substitution bug in pack stepgulp/pack.mjs, extension/task-metadata.json
Tool installer fails to download pac or set POWERPLATFORMTOOLS_PACCLIPATHInstaller task logicsrc/tasks/tool-installer/index.ts
New task input added to task.json but not wired through to pacindex.ts parameterMap not updatedsrc/tasks/<name>/index.ts
Task breaks after cli-wrapper version bump (interface mismatch)BuildToolsHost or BuildToolsRunnerParams out of syncsrc/host/BuildToolsHost.ts, src/host/BuildToolsRunnerParams.ts
Error message from task is unhelpful / missing contextBetter error surfacing neededsrc/tasks/<name>/index.ts

PPBT does NOT own it — do not fix in this repo — when:

SymptomActual owner
User forgot to add tool-installer to pipelineUser/pipeline config — document the fix, no code change
User passed solution display name instead of unique nameUser error
cli-wrapper assembles wrong pac args (but PPBT passed the right values to it)cli-wrapper repo
pac CLI crashes or returns a wrong resultpac CLI / admin-tools
Dataverse operation fails (solution import engine, HTTP 5xx)CDS / Solution Framework
Auth fails because service connection credentials are wrong/expiredUser / service connection admin
MFA required on username/password connectionUser — must switch to SPN

The test: ask "If the user configured the pipeline exactly right, would this still fail?" If yes → PPBT bug. If no → user error or downstream team.

2c — Classify the failure layer

Azure DevOps / GitHub Actions pipeline
  → [L1] user/pipeline config error (task ordering, missing inputs, wrong auth type)
  → [L2] PPBT code bug  (src/tasks/<name>/index.ts, getCredentials.ts, CliLocator.ts, etc.)
  → [L3] cli-wrapper bug  (@microsoft/powerplatform-cli-wrapper/dist/actions/)
  → [L4] pac CLI binary  (pac.exe / pac)
       └─ [L4-admin]  pac env/admin commands → admin-tools team
       └─ [L4-pac]    pac CLI crash / .NET exception → pac CLI team
       └─ [L4→L5]     pac correctly relays Dataverse error → CDS team
  → [L5] Power Platform API  (Dataverse / crm.dynamics.com)
SymptomLayerOwner
pac.exe not found / POWERPLATFORMTOOLS_PACCLIPATH not setL1User — tool-installer step missing
BuildTools.EnvironmentUrl targets wrong envL1User — task ordering side effect
Required input missing because user left it blankL1User — pipeline config
Checker fails with username/passwordL1User — SPN required for checker
Import times out (~4 min) on large solutionL1User — set AsyncOperation: true
Input exists in task.json but is ignored / not passed to pacL2PPBT bugindex.ts parameterMap
resolveCloudInstance() returns wrong cloud for valid endpointL2PPBT buggetCredentials.ts
Service connection field extracted as null despite being setL2PPBT buggetCredentials.ts
BuildTools.EnvironmentUrl not set after create-environmentL2PPBT bugindex.ts missing setVariable
Task breaks on Linux but works on WindowsL2PPBT bugCliLocator.ts
Wrong task GUIDs / tasks conflict in marketplaceL2PPBT bugpack.mjs / task-metadata.json
auth create failed after correct args passedL3cli-wrapper auth bug
Cannot resolve AAD authority / wrong AAD endpointL3cli-wrapper resolveCloudInstance()
WhoAmI fails on non-English agentL3cli-wrapper (known ADO #4846644)
pac CLI crashes / .NET exception inside pacL4-pacpac CLI team
pac env create/delete/backup/restore/copy failsL4-adminadmin-tools team
pac admin * command failsL4-adminadmin-tools team
pac auth create crashes after correct argsL4-pacpac CLI team
pac solution import/export/publish + Dataverse HTTP errorL4→L5CDS / Solution Framework
pac solution check / checker API errorL4→L5Power Apps Checker team
pac package deploy + Dataverse-side errorL4→L5CDS / Solution Framework
HTTP 4xx/5xx from crm.dynamics.comL5CDS / Solution Framework
Solution component errors / missing dependenciesL5CDS / Solution Framework
PVA component import failureL5pac CLI team (known IcM 604312672)

2d — pac command → owning team (the critical split)

When pac CLI exits non-zero, the owning team depends on which pac command ran AND where the error originates:

pac command                    → Error origin               → Owner
─────────────────────────────────────────────────────────────────────────────
pac auth create/clear          → pac crashes / token error  → pac CLI (admin-tools)
pac auth create/clear          → wrong args from wrapper    → cli-wrapper (L3)

pac env create/delete/         → any pac-side failure       → admin-tools
  backup/restore/copy/reset

pac admin *                    → any failure                → admin-tools

pac solution import            → pac crashes / bad args     → pac CLI (admin-tools)
pac solution import            → Dataverse API error        → CDS / Solution Framework
pac solution import            → PVA component error        → pac CLI (IcM 604312672)

pac solution export            → pac crashes / bad args     → pac CLI (admin-tools)
pac solution export            → Dataverse API error        → CDS / Solution Framework

pac solution publish           → Dataverse API error        → CDS / Solution Framework

pac solution check             → checker service error      → Power Apps Checker team

pac package deploy             → pac crashes               → pac CLI (admin-tools)
pac package deploy             → Dataverse-side error       → CDS / Solution Framework

How to tell pac crash vs Dataverse error:

  • pac crash / pac team: System.Exception, NullReferenceException, Unhandled exception, pac process exits with code 1 and no HTTP status in the message, InnerException in .NET stack trace
  • Dataverse error / CDS team: HTTP status code in error (400, 403, 404, 500), OrganizationServiceFault, ErrorCode:, Microsoft.Crm.* in the message, ImportJobId, solution operation GUID, The import of solution messages
  • Auth error / admin-tools or cli-wrapper: Azure AD / MSAL errors, AADSTS* error codes, interaction_required, token acquisition errors

Print:

Failing task: <task name>
pac command: <exact pac subcommand, e.g. "pac solution import">
Layer: <L1 | L2 | L3 | L4-pac | L4-admin | L4→L5>
Owner: <PPBT | cli-wrapper | pac-CLI/admin-tools | CDS/solution-framework | pipeline-config>
Error origin signal: <pac crash | Dataverse HTTP error | auth/AAD error | pipeline config>
Confidence: <high | medium | low>
Reasoning: <one sentence>

2d — pac CLI telemetry (L4-pac and L4→L5 only)

Run this step if and only if the layer is L4-pac or L4→L5.

pac CLI sends telemetry to PPUX Analytics via OneCollector. If the error output contains a Session ID like:

Sorry, the app encountered a non recoverable error and will need to terminate.
Session Id: 57f79894-80fb-4f44-8c94-8f800fc13e63,
Exception Type: System.ServiceModel.CommunicationException

Extract the Session ID and run the following Kusto query in PPUX Analytics to pull all telemetry events for that session:

EventAll
| where data_appName == "ppdevtools-pac"
| where data_clientSessionId == "<session-id-from-error>"

Additional useful queries:

Get the exact commands executed in the session:

EventAll
| where data_appName == "ppdevtools-pac"
| where data_clientSessionId == "<session-id-from-error>"
| where data_eventModifier == "Complete"
| extend eventInfo = parse_json(data_eventInfo)
| project eventInfo.command, timestamp

Get all errors in the session:

EventAll
| where data_appName == "ppdevtools-pac"
| where data_clientSessionId == "<session-id-from-error>"
| where data_eventModifier == "Failed" or data_severity >= 3
| project timestamp, data_eventName, data_eventInfo

If no Session ID is present in the log: note it and proceed — telemetry lookup not possible without it.

Print telemetry findings before continuing to Step 3.


Step 3 — Search for known issues (run all in parallel)

Extract 2–3 keywords from the error.

3a — GitHub issues

gh search issues --repo microsoft/powerplatform-build-tools \
  --state open --limit 10 "<keyword1> <keyword2>" 2>&1
gh search issues --repo microsoft/powerplatform-build-tools \
  --state closed --limit 5 "<keyword1> <keyword2>" 2>&1

3b — Merged PRs

gh search prs --repo microsoft/powerplatform-build-tools \
  --state merged --limit 5 "<keyword1> <keyword2>" 2>&1

3c — ADO work items

az boards query --wiql "
  SELECT [System.Id], [System.Title], [System.State], [System.ChangedDate]
  FROM WorkItems
  WHERE [System.AreaPath] UNDER 'OneCRM\Client\UnifiedClient\AppLifeCycle\PPBT Extensions'
    AND [System.Title] CONTAINS '<keyword1>'
  ORDER BY [System.ChangedDate] DESC
" --output json 2>&1

3d — Local knowledge base

Read memory/ado-knowledge.md and check MEMORY.md known customer issues section.

Research summary (print before acting)

Known issue match: <issue/PR/ADO ID + title, or "none">
Accepted risk: <yes — <reason>, or "no">
Fix already shipped: <yes — in PR #<n> / pac version <v>, or "no">
Recommended action: <resolve | triage | deflect | update-pac | pipeline-fix>

If a confirmed fix already exists in a merged PR or shipped pac CLI version, report it and stop here.


Step 4 — Resolve (L1 pipeline config or L2 build-tools code)

L1 — Pipeline configuration fix (no code change)

Produce a precise fix instruction:

Pipeline fix required:
- Issue: <what's wrong>
- Fix: <exact YAML or UI step>
- Reference: <task name + parameter from Step 2 tables>

Common L1 fixes:

  • Missing tool-installer → add PowerPlatformToolInstaller@2 as first step
  • Import timeout → add AsyncOperation: true and MaxAsyncWaitTime: 60
  • Wrong environment targeted → check BuildTools.EnvironmentUrl side effect from create-environment
  • Checker with username/password → switch service connection to SPN
  • Connection references missing → add UseDeploymentSettingsFile: true + provide DeploymentSettingsFile
  • GitHub Actions: timeout installing pac CLI → add actions-install@v1 before other actions

L2 — Build-tools code fix (this repo)

  1. Read the relevant src/tasks/<name>/index.ts and task.json
  2. Make the minimal fix
  3. npm run build 2>&1 — must pass
  4. npm test 2>&1 — must pass (functional test failures are expected locally — not a blocker)
  5. git commit -m "fix: <description> (#<work-item-id-if-known>)"
  6. Hand off to /create-pr

Step 5 — Triage package (L3–L5 and non-PPBT)

Routing table

Shortened here. Read the whole file on GitHub.

Signals

GitHub stars
303
Forks
71
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
debug-agent
Source
github.com/microsoft/powerplatform-build-tools