A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
CLI Binary Resolution (pa preferred, power-apps fallback)
This file is the single source of truth for which CLI binary to run and how to translate commands. Every skill that runs a Power Apps CLI command MUST resolve the binary using the algorithm below before running any command, and MUST author commands in the canonical grouped pa form (see the mapping table). It also defines PA_INLINE_CONNECTIONS, which tells connector skills whether pa app add data-source needs a connection ID (see Inline connection capability).
Why two binaries
@microsoft/power-apps-cli has shipped two executables:
| Binary | Syntax | Example |
|---|---|---|
pa |
grouped | pa app add data-source --connector ... |
power-apps |
flat | power-apps add-data-source -a ... |
Which ones a project has depends on the installed CLI version: versions before 0.15 ship only the flat power-apps, 0.15.x ships both, and 1.0.0 and later ship only pa. A project's node_modules/.bin/pa shim therefore exists only if the installed CLI is 0.15 or later; older projects have only power-apps. We therefore prefer pa and fall back to power-apps.
Two things differ between the binaries — the verb structure AND some flags:
- Verb structure — grouped noun-verb (
pa app push) vs flat (power-apps push). See the command mapping table. - Flag renames — the grouped
pasurface renames several customer-facing selector flags and drops their short aliases. The flatpower-appssurface keeps the original flags byte-identical. See the flag mapping table.
When translating a canonical pa command to flat power-apps, you must convert both the verb path and any renamed flags.
Resolution algorithm (run once per session, then cache)
Resolve from the project root (the directory containing package.json / power.config.json):
# Prefer the grouped `pa` binary; fall back to flat `power-apps`.
# --no-install is REQUIRED: it stops npx from silently fetching a remote
# package named `pa`/`power-apps` from the registry if no local shim exists.
# Probe both the extensionless shim (bash/sh) and the `.cmd` shim that
# package managers create on Windows, so a valid install is never missed.
if [ -e node_modules/.bin/pa ] || [ -e node_modules/.bin/pa.cmd ]; then
PA="npx --no-install pa" # grouped syntax → use the "pa" column below
PA_KIND="pa"
elif [ -e node_modules/.bin/power-apps ] || [ -e node_modules/.bin/power-apps.cmd ]; then
PA="npx --no-install power-apps" # flat syntax → translate via the mapping table
PA_KIND="power-apps"
else
# Neither shim present → the CLI is not installed in this project.
# Run `npm install` and re-probe; if still missing, install it as a dev dependency (rule 4).
PA=""
PA_KIND="none"
fi
Rules:
Pick the binary by file presence only — do not parse a version to choose between
paandpower-apps. A shim (.bin/paor, on Windows,.bin/pa.cmd) existing == the grouped binary is available. This is deterministic and cheaper than spawning--version. Always check the.cmdvariant too: npm/pnpm/yarn/bun createpa.cmd/power-apps.cmdon Windows and an extensionless-only probe would misclassify a valid install asnone. (The version is read once afterwards, only for the inline connection capability.)Always use
npx --no-install. Never run a barenpx pa ...: if the local shim is missing, npx would try to download and execute an unrelated remote package namedpa.--no-installfails closed instead.Cache the result in the project memory bank (
CLI BinaryandCLI Versionrows — seememory-bank.md) so subsequent skills/commands in the session don't re-probe. Re-probe only after annpm installthat could have changed the installed CLI.none→ install first. If neither shim exists, runnpm installin the project root and re-probe; this restores a CLI the project already declares. If it is stillnone, the project doesn't declare the CLI (the Vite template doesn't include it), so install it into the project as a dev dependency and re-probe:npm install --save-dev "@microsoft/power-apps-cli@^1.3.0"Install it into the project, not globally — skills always run it through
npx --no-install.
Inline connection capability
CLI 1.3.0 and later can find or create the connection a connector data source needs, so pa app add data-source doesn't require -c <connection-id> for connectors. Older CLIs require it. See connector-reference.md for both flows.
Determine the capability once, right after resolving $PA. When PA_KIND=pa, read the installed version:
$PA --version # prints the installed CLI version, e.g. 1.3.0
PA_INLINE_CONNECTIONS=yeswhenPA_KIND=paand the version is 1.3.0 or later.- Otherwise
PA_INLINE_CONNECTIONS=no. That includes everyPA_KIND=power-appsproject: the flat binary only exists in CLI versions before 1.0. - Record the version in the memory bank (
CLI Versionrow) next toCLI Binary, and re-check it after anynpm installthat could change the CLI. - Don't prompt the user to upgrade an existing project's CLI for this. Projects on older CLIs keep the explicit connection-ID flow.
Authoring rule for skills
- Author every command in the canonical grouped
paform (the left/pacolumn below), using the renamedpaflags from the flag mapping table, e.g.pa app push,pa app add data-source --connector shared_office365 -c <conn-id>. - Substitute the resolved
$PAprefix (which already containsnpx --no-install) for the binary at run time. WhenPA_KIND=pa, run the canonical command as-is:$PA app push→npx --no-install pa app push. WhenPA_KIND=power-apps, translate the verb path (and renamed flags) per the next rule before running:$PA push→npx --no-install power-apps push. - If
PA_KINDispower-apps, translate each grouped command to its flat equivalent before running it — convert BOTH the verb path AND any renamed flags. The flat binary does not understand the grouped noun-verb form (power-apps app pushis invalid — it must becomepower-apps push), and it does not accept the renamed long flags (--connectormust become--api-id/-a,--tablemust become--resource-name/-t, etc.). - Most flags are unchanged — only the selector flags in the flag mapping table are renamed on
pa. Connection ID (-c), dataset (-d), environment (-e), and display name (-noninit/connection create) are identical on both binaries. - Whether
-cis required depends on the CLI version. For connector data sources,-c <connection-id>is optional only whenPA_INLINE_CONNECTIONS=yes; otherwise it's required. Follow connector-reference.md instead of deciding per skill.
Command-scoped attribution
Apply this prefix only when a Code Apps skill initiates a resolved CLI command:
env -u PA_PLUGIN_REPORT_AGENT PA_CLI_ORIGIN="${PA_CLI_ORIGIN-plugin}" $PA app list
Replace app list with the required operation and retain its arguments.
Translate flat-binary operations using the mapping table below.
For output capture, place the prefix inside the command substitution:
apps="$(env -u PA_PLUGIN_REPORT_AGENT PA_CLI_ORIGIN="${PA_CLI_ORIGIN-plugin}" $PA app list --json)"
env applies these values only to the CLI child process.
The ${PA_CLI_ORIGIN-plugin} expression preserves user values, including an empty value.
Removing an inherited plugin report lets the CLI detect the current AI tool.
Do not manually select an agent label or set passive detection markers.
Do not use this prefix for user-authored commands or non-CLI tools.
Do not export these variables into the parent shell.
Use Bash for these examples, as with the existing $PA resolution contract.
If Bash is unavailable, run the CLI without attribution rather than modify a shared
PowerShell environment or block the requested operation.
Command mapping table (grouped pa ↔ flat power-apps)
| Operation | Canonical (pa) |
Flat (power-apps) |
|---|---|---|
| Initialize project | pa app init |
power-apps init |
| Deploy / push | pa app push |
power-apps push |
| Local dev server | pa app run |
power-apps run |
| List code apps | pa app list |
power-apps list-codeapps |
| Add data source | pa app add data-source |
power-apps add-data-source |
| Add Dataverse API | pa app add dataverse-api |
power-apps add-dataverse-api |
| Add flow | pa app add flow |
power-apps add-flow |
| Remove data source | pa app remove data-source |
power-apps delete-data-source |
| Remove flow | pa app remove flow |
power-apps remove-flow |
| Refresh data source | pa app refresh data-source |
power-apps refresh-data-source |
| Find Dataverse API | pa app find-dataverse-api |
power-apps find-dataverse-api |
| List environment vars | pa app list-environment-variables |
power-apps list-environment-variables |
| List flows | pa app list-flows |
power-apps list-flows |
| List connections | pa connection list |
power-apps list-connections |
| List connection refs | pa connection list-references |
power-apps list-connection-references |
| Create connection | pa connection create |
power-apps create-connection |
| List connectors | pa connector list |
power-apps list-connectors |
| List datasets | pa connection list-datasets |
power-apps list-datasets |
| List tables | pa connection list-tables |
power-apps list-tables |
| List stored procedures | pa connection list-procedures |
power-apps list-sqlStoredProcedures |
| Sign in | pa auth login |
power-apps login |
| Sign out | pa auth logout |
power-apps logout |
| Auth status | pa auth status |
power-apps auth-status |
| Switch account | pa auth switch |
power-apps auth-switch |
| Telemetry enable | pa telemetry enable |
power-apps telemetry --enable |
| Telemetry disable | pa telemetry disable |
power-apps telemetry --disable |
| Telemetry status | pa telemetry status |
power-apps telemetry --show-settings |
Note: the operations above differ only in verb structure. Renamed flags (which apply to several of these operations) are listed separately in the flag mapping table below.
Flag mapping table (grouped pa ↔ flat power-apps)
The grouped pa surface renames these customer-facing selector flags and drops their short aliases. The flat power-apps surface keeps the original flag names and aliases. All other flags are identical on both binaries.
| Selector | Canonical (pa) |
Flat (power-apps) |
Used by |
|---|---|---|---|
| Connector / API | --connector |
--api-id (alias -a) |
add data-source, connection list-datasets, connection list-tables, connection create |
| Table / resource | --table |
--resource-name (alias -t) |
add data-source |
| Data source name | --name |
--data-source-name (alias -n) |
add data-source, refresh data-source |
| SQL stored procedure | --procedure |
--sql-stored-procedure (alias -sp) |
add data-source |
| Connection reference | --connection-ref |
--connection-ref (alias -cr) |
add data-source (Dataverse) — alias -cr dropped on pa, long flag unchanged |
Unchanged on both binaries (do NOT rewrite these): --connection-id/-c, --dataset/-d, --environment-id/-e, --display-name/-n (on init and connection create), --solution-id, --search, --cloud.
⚠️
-nis context-dependent. Onadd data-source/refresh data-source,-nis the (renamed)data-source-name→--name. Oninitandconnection create,-nisdisplay-name, which is not renamed. Translate based on the verb, not the letter.
pa-only switch (CLI 1.3.0+)
| Switch | Used by | Meaning |
|---|---|---|
--use-sso |
add data-source, connection create |
Use a single sign-on (Microsoft Entra ID) connection, even when the connector also offers other sign-in types. add data-source reuses the first existing single sign-on connection or creates one silently; connection create creates one silently. Fails if the connector doesn't support single sign-on. Ignored with --connection-id/--connection-ref and for Dataverse. |
The flat power-apps binary has no equivalent. Don't translate it; projects with PA_INLINE_CONNECTIONS=no use the explicit connection-ID flow in connector-reference.md.
npx prefix note
Skill examples elsewhere in the plugin are written in the canonical grouped pa form (e.g. pa app push). These are authoring shorthand — read them as the canonical operation, resolve $PA, and run the resolved form with the required npx --no-install prefix:
- resolved
pa→npx --no-install pa <noun> <verb> ... - resolved
power-apps→ translate via the mapping table, thennpx --no-install power-apps <verb> ...