Skip to content

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.

code-apps: let Power Apps CLI 1.3.0+ find or create connections (#768)

Madhu Mach2eb182a8b7a2
diff --git a/plugins/code-apps/.claude-plugin/plugin.json b/plugins/code-apps/.claude-plugin/plugin.json
index 50548a8af..48db7df79 100644
--- a/plugins/code-apps/.claude-plugin/plugin.json
+++ b/plugins/code-apps/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "code-apps-preview",
- "version": "1.1.1",
+ "version": "1.2.0",
"description": "Build and deploy Power Apps code apps using React, Vite, and Power Platform connectors.",
"author": {
"name": "Microsoft",
diff --git a/plugins/code-apps/.plugin/plugin.json b/plugins/code-apps/.plugin/plugin.json
index 50548a8af..48db7df79 100644
--- a/plugins/code-apps/.plugin/plugin.json
+++ b/plugins/code-apps/.plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "code-apps-preview",
- "version": "1.1.1",
+ "version": "1.2.0",
"description": "Build and deploy Power Apps code apps using React, Vite, and Power Platform connectors.",
"author": {
"name": "Microsoft",
diff --git a/plugins/code-apps/AGENTS.md b/plugins/code-apps/AGENTS.md
index 26013b6a2..2c7437311 100644
--- a/plugins/code-apps/AGENTS.md
+++ b/plugins/code-apps/AGENTS.md
@@ -43,7 +43,7 @@ skills/
deploy/
SKILL.md <- Build and deploy an existing code app
list-connections/
- SKILL.md <- List Power Platform connections to get connection IDs
+ SKILL.md <- List connections (connection IDs; optional on CLI 1.3.0+)
add-datasource/
SKILL.md <- Router: asks what you need and picks the right add-* skill
add-connector/
@@ -74,7 +74,7 @@ skills/
|-------|-------------|
| `/create-code-app` | Scaffold, configure, and deploy a new Power Apps code app |
| `/deploy` | Build and deploy an existing code app |
-| `/list-connections` | List Power Platform connections to find connection IDs |
+| `/list-connections` | List Power Platform connections and their IDs (required before adding a connector only on CLIs older than 1.3.0) |
| `/add-datasource` | Add a data source (routes to the appropriate add-* skill) |
| `/add-dataverse` | Add Dataverse tables with generated TypeScript models and services |
| `/add-sharepoint` | Add SharePoint Online connector |
@@ -92,6 +92,10 @@ skills/
Power Apps code apps run in a sandbox — direct HTTP calls (`fetch`, `axios`, Graph API, etc.) do not work at runtime. **All external data access must go through Power Platform connectors.**
+### Connections
+
+Every non-Dataverse data source is bound to a connection. With Power Apps CLI 1.3.0+ (which `/create-code-app` installs), `pa app add data-source` finds the connector's connection or creates one, so connector skills omit `-c`. Older CLIs need `-c <connection-id>`. [shared/connector-reference.md](./shared/connector-reference.md) defines both flows and when to ask the user first.
+
### Generated Services
`pa app add data-source` generates typed TypeScript services in `src/generated/`:
@@ -102,7 +106,7 @@ Always use generated services for data access.
### CLI
-The Power Apps CLI (`@microsoft/power-apps-cli`) is installed locally via `npm install` as part of the app template. It ships two binaries — grouped **`pa`** (preferred) and flat **`power-apps`** (fallback). **Resolve which one the project has via [shared/cli-binary.md](./shared/cli-binary.md) first**, then invoke it with `npx --no-install <pa|power-apps>` from the project directory — runs natively in bash on all platforms, no PowerShell wrapper needed. Commands below use the canonical grouped `pa` form:
+The Power Apps CLI (`@microsoft/power-apps-cli`) is installed into each project as a dev dependency; the Vite template doesn't include it, so `/create-code-app` adds it. It has shipped two binaries — grouped **`pa`** (preferred) and flat **`power-apps`** (fallback). **Resolve which one the project has via [shared/cli-binary.md](./shared/cli-binary.md) first**, then invoke it with `npx --no-install <pa|power-apps>` from the project directory — runs natively in bash on all platforms, no PowerShell wrapper needed. Commands below use the canonical grouped `pa` form:
Shell hooks automatically supply `PA_CLI_ORIGIN=plugin/<host-agent>` for recognized
CLI invocations without replacing explicit user values. Do not manually export
@@ -126,6 +130,9 @@ Always use `npx degit` to create new projects — never `git clone` or manual fi
```bash
npx degit microsoft/PowerAppsCodeApps/templates/vite {folder} --force
+cd {folder}
+npm install
+npm install --save-dev "@microsoft/power-apps-cli@^1.3.0" # the template doesn't include the CLI
```
## Testing Changes
diff --git a/plugins/code-apps/README.md b/plugins/code-apps/README.md
index 0349bddb2..00ad4fc59 100644
--- a/plugins/code-apps/README.md
+++ b/plugins/code-apps/README.md
@@ -42,6 +42,17 @@ Open GitHub Copilot CLI or Claude Code in any folder and run the following comma
Start with `/create-code-app` — it walks you through everything.
+## Connections
+
+Connectors other than Dataverse use a connection: the saved sign-in a connector uses to call its service. New projects get Power Apps CLI 1.3.0 or later installed automatically, so the plugin can reuse your existing connection or create one for you:
+
+- **One connection for the connector:** the plugin uses it.
+- **Several connections:** the plugin asks which one to use.
+- **No connection, and the connector signs in only with your Microsoft account (single sign-on):** the CLI creates one with your account while adding the connector. The plugin tells you before it starts the add.
+- **No connection otherwise:** the plugin asks for your OK before it creates one, either with single sign-on (`--use-sso`) or by running `pa connection create`. If the connector needs a browser sign-in, it may ask you to run `pa connection create` in your own terminal.
+
+Projects on an older CLI keep working: the plugin looks up the connection ID first.
+
## CLI attribution
Before recognized Power Apps CLI shell commands, the plugin supplies
diff --git a/plugins/code-apps/agents/code-app-architect.md b/plugins/code-apps/agents/code-app-architect.md
index 5113bcc66..9ee2c9e12 100644
--- a/plugins/code-apps/agents/code-app-architect.md
+++ b/plugins/code-apps/agents/code-app-architect.md
@@ -43,7 +43,7 @@ node --version # Must be v22+
- **Node.js below v22**: Report "Node.js 22+ is required. Upgrade or switch with `nvm use 22`." and STOP.
- **All present**: Report versions and proceed.
-The Power Apps CLI is installed automatically via `npm install` from the app template — no separate install required.
+The Power Apps CLI is installed into each project as a dev dependency (`/create-code-app` does this; see [cli-binary.md](../shared/cli-binary.md)) — no global install required.
## Key Considerations for Power Apps Code Apps
@@ -66,7 +66,7 @@ The Power Apps CLI is installed automatically via `npm install` from the app tem
**If none of the specific skills match**, invoke `/add-connector` — it handles any connector not covered above. Browse available connectors at https://learn.microsoft.com/en-us/connectors/connector-reference/ to find the correct API name. **If no connector exists for the required functionality, tell the user clearly and do not implement a direct API call as a workaround — it will not work in production.**
-**Connection IDs**: All non-Dataverse connectors require a connection ID (`-c` flag). Run `/list-connections` to find it, then run `pa app add data-source --connector <connector> -c <connection-id>`.
+**Connections**: All non-Dataverse connectors need a connection. With CLI 1.3.0+, `pa app add data-source` finds or creates it, so the connector skills omit `-c`; older CLIs need `-c <connection-id>` from `/list-connections`. See [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections).
### Generated Code Pattern
@@ -84,6 +84,7 @@ Always use `npx degit` to scaffold new projects — do **not** use `git clone`,
npx degit microsoft/PowerAppsCodeApps/templates/vite {folder} --force
cd {folder}
npm install
+npm install --save-dev "@microsoft/power-apps-cli@^1.3.0"
```
After scaffolding, initialize:
@@ -104,9 +105,9 @@ pa app init -n '{app-name}' -e <environment-id>
### Connector Workarounds
- **Azure DevOps**: HttpRequest method requires renaming `parameters` to `body` in 3 generated files.
-- **SharePoint/Excel**: Tabular datasources need `--dataset` and `--table` parameters when adding.
+- **SharePoint/Excel**: Tabular datasources need `--dataset` and `--table` parameters when adding. SharePoint's file and folder operations are its actions; add them with `--as action`.
- **Excel Online**: Body is a flat key-value object -- no `{ items: ... }` wrapper.
-- **Work IQ** (`shared_a365copilotchatmcp`): stateless-tolerant MCP connector — the connection is created with `pa connection create` (browser OAuth) and it needs the `McpSession` wrapper (send **no** session id on `initialize`). See the `/add-workiq` skill for setup steps.
+- **Work IQ** (`shared_a365copilotchatmcp`): stateless-tolerant MCP connector that needs the `McpSession` wrapper (send **no** session id on `initialize`). On CLI 1.3.0+, `pa app add data-source` finds or creates its connection; older CLIs create it with `pa connection create`. See the `/add-workiq` skill for setup steps.
### Default Environment
@@ -114,14 +115,15 @@ Check `power.config.json` in the project root for an `environmentId` — use it
### CLI Commands
-The Power Apps CLI (`@microsoft/power-apps-cli`) installs locally via `npm install`. It ships two binaries — grouped **`pa`** (preferred) and flat **`power-apps`** (fallback). **Resolve which one the project has via [cli-binary.md](../shared/cli-binary.md) before running any command**, then invoke it with `npx --no-install <pa|power-apps>` from the project directory (works natively in bash on all platforms). Commands below are shown in the canonical grouped `pa` form:
+The Power Apps CLI (`@microsoft/power-apps-cli`) is installed into each project as a dev dependency. It has shipped two binaries — grouped **`pa`** (preferred) and flat **`power-apps`** (fallback). **Resolve which one the project has via [cli-binary.md](../shared/cli-binary.md) before running any command**, then invoke it with `npx --no-install <pa|power-apps>` from the project directory (works natively in bash on all platforms). Commands below are shown in the canonical grouped `pa` form:
```bash
pa app push # Deploy
-pa app add data-source --connector <api> -c <id> # Add connector
+pa app add data-source --connector <api> [-c <id>] # Add connector (-c optional on CLI 1.3.0+)
pa connection list # List connections
-pa connector list-datasets --connector <api> -c <id> # List datasets
-pa connector list-tables --connector <api> -c <id> -d <ds> # List tables
+pa connection create --connector <api> # Create a connection
+pa connection list-datasets --connector <api> -c <id> # List datasets
+pa connection list-tables --connector <api> -c <id> -d <ds> # List tables
pa auth logout # Log out
```
diff --git a/plugins/code-apps/shared/cli-binary.md b/plugins/code-apps/shared/cli-binary.md
index bbf2aa9c6..1bd89d465 100644
--- a/plugins/code-apps/shared/cli-binary.md
+++ b/plugins/code-apps/shared/cli-binary.md
@@ -1,24 +1,24 @@
# 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).
+**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](#inline-connection-capability)).
---
## Why two binaries
-`@microsoft/power-apps-cli` ships two executables from the **same package**:
+`@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 ...` |
-Both are installed together, so a project's `node_modules/.bin/pa` shim exists **only if** the installed CLI version is new enough to include the grouped `pa` binary. Older projects have only `power-apps`. We therefore **prefer `pa`** and **fall back to `power-apps`**.
+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:**
1. **Verb structure** — grouped noun-verb (`pa app push`) vs flat (`power-apps push`). See the command mapping table.
-2. **Flag renames** — the grouped `pa` surface renames several customer-facing selector flags and **drops their short aliases** (the "Phase 2" `grouped_flag_renames` mechanism, now live). The flat `power-apps` surface keeps the original flags byte-identical. See the flag mapping table.
+2. **Flag renames** — the grouped `pa` surface renames several customer-facing selector flags and **drops their short aliases**. The flat `power-apps` surface 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.
@@ -41,8 +41,8 @@ elif [ -e node_modules/.bin/power-apps ] || [ -e node_modules/.bin/power-apps.cm
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 yet.
- # Run `npm install` in the project root (per the normal scaffold flow), then re-probe.
+ # 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
@@ -50,10 +50,33 @@ fi
Rules:
-1. **Probe by file presence only** — do not pin or parse a version. A shim (`.bin/pa` or, on Windows, `.bin/pa.cmd`) existing == the grouped binary is available. This is deterministic and cheaper than spawning `--version`. Always check the `.cmd` variant too: npm/pnpm/yarn/bun create `pa.cmd`/`power-apps.cmd` on Windows and an extensionless-only probe would misclassify a valid install as `none`.
+1. **Pick the binary by file presence only** — do not parse a version to choose between `pa` and `power-apps`. A shim (`.bin/pa` or, on Windows, `.bin/pa.cmd`) existing == the grouped binary is available. This is deterministic and cheaper than spawning `--version`. Always check the `.cmd` variant too: npm/pnpm/yarn/bun create `pa.cmd`/`power-apps.cmd` on Windows and an extensionless-only probe would misclassify a valid install as `none`. (The version is read once afterwards, only for the [inline connection capability](#inline-connection-capability).)
2. **Always use `npx --no-install`.** Never run a bare `npx pa ...`: if the local shim is missing, npx would try to download and execute an unrelated remote package named `pa`. `--no-install` fails closed instead.
-3. **Cache the result** in the project memory bank (`CLI Binary` row — see `memory-bank.md`) so subsequent skills/commands in the session don't re-probe. Re-probe only after an `npm install` that could have changed the installed CLI.
-4. **`none` → install first.** If neither shim exists, the CLI isn't installed; run the project's `npm install` (already part of the scaffold flow) and re-probe before running any command.
+3. **Cache the result** in the project memory bank (`CLI Binary` and `CLI Version` rows — see `memory-bank.md`) so subsequent skills/commands in the session don't re-probe. Re-probe only after an `npm install` that could have changed the installed CLI.
+4. **`none` → install first.** If neither shim exists, run `npm install` in the project root and re-probe; this restores a CLI the project already declares. If it is still `none`, 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:
+
+ ```bash
+ 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](./connector-reference.md) for both flows.
+
+Determine the capability once, right after resolving `$PA`. When `PA_KIND=pa`, read the installed version:
+
+```bash
+$PA --version # prints the installed CLI version, e.g. 1.3.0
+```
+
+- `PA_INLINE_CONNECTIONS=yes` when `PA_KIND=pa` and the version is **1.3.0 or later**.
+- Otherwise `PA_INLINE_CONNECTIONS=no`. That includes every `PA_KIND=power-apps` project: the flat binary only exists in CLI versions before 1.0.
+- Record the version in the memory bank (`CLI Version` row) next to `CLI Binary`, and re-check it after any `npm install` that 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.
---
@@ -63,6 +86,7 @@ Rules:
- Substitute the resolved `$PA` prefix (which already contains `npx --no-install`) for the binary at run time. When `PA_KIND=pa`, run the canonical command as-is: `$PA app push` → `npx --no-install pa app push`. When `PA_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_KIND` is `power-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 push` is invalid — it must become `power-apps push`), and it does **not** accept the renamed long flags (`--connector` must become `--api-id`/`-a`, `--table` must 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 (`-n` on `init`/`connection create`) are identical on both binaries.
+- **Whether `-c` is required depends on the CLI version.** For connector data sources, `-c <connection-id>` is optional only when `PA_INLINE_CONNECTIONS=yes`; otherwise it's required. Follow [connector-reference.md](./connector-reference.md) instead of deciding per skill.
---
@@ -87,9 +111,9 @@ Rules:
| 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 connector list-datasets` | `power-apps list-datasets` |
-| List tables | `pa connector list-tables` | `power-apps list-tables` |
-| List stored procedures | `pa connector list-procedures` | `power-apps list-sqlStoredProcedures` |
+| 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` |
@@ -108,16 +132,24 @@ The grouped `pa` surface renames these customer-facing selector flags and **drop
| Selector | Canonical (`pa`) | Flat (`power-apps`) | Used by |
| ----------------------- | -------------------- | ---------------------------------- | --------------------------------------------------- |
-| Connector / API | `--connector` | `--api-id` (alias `-a`) | `add data-source`, `connector list-*`, `connection create` |
+| 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`) | `connector list-procedures` |
+| 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`.
> ⚠️ **`-n` is context-dependent.** On `add data-source`/`refresh data-source`, `-n` is the (renamed) `data-source-name` → `--name`. On `init` and `connection create`, `-n` is `display-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](./connector-reference.md).
+
---
## `npx` prefix note
diff --git a/plugins/code-apps/shared/connector-reference.md b/plugins/code-apps/shared/connector-reference.md
index 0bba1c256..d02a1f63c 100644
--- a/plugins/code-apps/shared/connector-reference.md
+++ b/plugins/code-apps/shared/connector-reference.md
@@ -1,28 +1,95 @@
# Connector Reference
-Applies to all connector skills (`/add-azuredevops`, `/add-teams`, `/add-excel`, `/add-onedrive`, `/add-sharepoint`, `/add-office365`, `/add-mcscopilot`, `/add-connector`). Does NOT apply to Dataverse (`/add-dataverse`).
+Applies to all connector skills (`/add-azuredevops`, `/add-teams`, `/add-excel`, `/add-onedrive`, `/add-sharepoint`, `/add-office365`, `/add-mcscopilot`, `/add-workiq`, `/add-connector`). Does NOT apply to Dataverse (`/add-dataverse`).
-## Connection ID (Required)
+## Connections
-All non-Dataverse connectors require a **connection ID** (`-c`) when adding via `pa app add data-source`. Without it, the command fails with: `CONNECTION_ID argument is required for connector data sources`.
+Every non-Dataverse data source is bound to a **connection**: the saved sign-in the connector uses to call its service. How a skill gets one depends on the installed CLI. Resolve `$PA` and `PA_INLINE_CONNECTIONS` first (see [cli-binary.md](./cli-binary.md)), then follow the matching flow:
-### Step 1: List Existing Connections
+| `PA_INLINE_CONNECTIONS` | CLI | Flow |
+| ----------------------- | -------------------------------- | ---- |
+| `yes` | `pa` 1.3.0 or later | [Inline connections](#inline-connections-cli-130-and-later): the CLI finds or creates the connection |
+| `no` | Older `pa`, or flat `power-apps` | [Explicit connection ID](#explicit-connection-id-older-clis): find the ID first and pass `-c` |
+
+In both flows:
+
+- **A known connection ID wins.** If the caller or the user already supplied a connection ID, pass it with `-c <connection-id>`; the CLI then skips connection lookup.
+- **Never choose between connections yourself.** When a connector has several connections, ask the user which one to use.
+- **Don't record connections.** Never write connection names or IDs to the memory bank (see [memory-bank.md](./memory-bank.md)).
+- **Choose table or actions up front.** For connectors that support both (SharePoint, SQL Server, Excel Online), pass `--table` (or `--procedure` for SQL) to add a table, or `--as action` to add the connector's actions. From CLI 1.2.0, a non-interactive add that does neither fails. Older CLIs have no `--as`; add tables with `-d` and `--table`. To check whether a connector supports tables, read `isTabular` from `pa connector list --search '<connector name>' --json`.
+
+### Inline connections (CLI 1.3.0 and later)
+
+1. **Tell the user first.** In one line, say that adding the connector may create a connection with their Microsoft account if they don't have one yet.
+2. **Run the add without `-c`**, always with `--non-interactive`. The agent's shell can't answer the CLI's interactive connection picker, and `--non-interactive` guarantees the CLI never shows it:
+
+ ```bash
+ # Non-tabular connectors
+ pa app add data-source --connector <connector-id> --non-interactive
+
+ # Tables (SharePoint, SQL Server): also pass the dataset and table
+ pa app add data-source --connector <connector-id> -d '<dataset>' --table '<table>' --non-interactive
+ ```
+
+ Listing datasets and tables (`pa connection list-datasets` / `list-tables`) needs a connection ID (these commands don't find or create connections, and fail without `-c` in non-interactive mode), so tabular skills such as `/add-sharepoint` look the connection up before the add.
+
+3. **Act on the result:**
+
+ | CLI output | Exit | What to do |
+ | --- | --- | --- |
+ | `Using existing connection '<Name>' (<id>).` | 0 | Continue. Tell the user which connection was used. |
+ | `Created a new connection '<Name>' (<id>).` | 0 | Continue. Tell the user a connection was created with their account. The CLI does this only for connectors whose only sign-in option is the user's Microsoft account (single sign-on), or that need no sign-in. |
+ | `Multiple connections exist for '<Connector>', so one cannot be selected automatically.` (the candidates are listed with it) | 2 | Show the candidates and ask the user to pick one. Re-run with `-c <id>`. |
+ | `'<Connector>' requires a connection that cannot be created automatically in non-interactive mode.` | 2 | If the output also says `Tip: '<Connector>' supports single sign-on`, ask the user whether to create a single sign-on connection with their account; if they agree, re-run with `--use-sso`. Otherwise [create the connection with the user](#create-a-connection-with-the-user). |
+ | `No connection exists for '<Connector>' and automatic connection creation failed.` (or `No SSO connection exists …` with `--use-sso`) | 2, 3, or 5 | Exit 3 is a sign-in problem: run `pa auth login`, then retry once. Exit 5 is a network problem: retry once. Exit 2, or a second failure: [create the connection with the user](#create-a-connection-with-the-user). |
+ | `You are not signed in` or `Your sign-in session has expired …` (`Run 'pa auth login' to sign in, then retry.`) | 3 | Run `pa auth login`; it opens the browser so the user can sign in. If it can't open a browser from your shell, ask the user to run `pa auth login` in their own terminal (or `npx --no-install pa auth login` from the project folder if `pa` isn't recognized). Then retry once. |
+ | `--use-sso was set but '<Connector>' does not support single sign-on (SSO) authentication.` | 2 | Re-run without `--use-sso` and handle the result with this table. |
+ | An error that ends with `Note: connection '<Name>' (<id>) was created for this command and has been kept.` | non-zero | Fix the reported problem, then re-run with `-c <id>`. |
+
+ For any other failure, report the exact output and stop (see Command Failure Handling in [shared-instructions.md](./shared-instructions.md)).
+
+#### `--use-sso`
+
+`--use-sso` makes the CLI use a single sign-on connection even when the connector also offers other sign-in types (for example SharePoint or SQL Server). It reuses the first existing single sign-on connection, or silently creates one. **Ask the user before passing it**, because it can create a connection with their account. To check in advance whether a connector supports single sign-on, read `supportsSso` from:
+
+```bash
+pa connector list --search '<connector name>' --json
+```
+
+#### Create a connection with the user
+
+Creating a connection that needs a browser sign-in only works from an interactive terminal, which the agent's shell usually isn't. Hand this step to the user:
+
+1. Ask them to run this in their own terminal, from the project folder, and finish signing in in the browser:
+
+ ```bash
+ pa connection create --connector <connector-id>
+ ```
+
+ If `pa` isn't recognized (the CLI is installed only in the project, not globally), they can run `npx --no-install pa connection create --connector <connector-id>` instead; on `power-apps`-only projects it's `npx --no-install power-apps create-connection -a <connector-id>`. Or they can create it in the maker portal: `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** (use the environment ID from `power.config.json`).
+2. When they confirm it's done, re-run the same add. With exactly one connection for the connector, the CLI uses it automatically.
+
+Create connections only when the connector has none: every extra connection makes later adds ambiguous. Before running `pa connection create` yourself (for example with `--use-sso`), check `pa connection list --search <connector-id> --json` and ask the user first.
+
+### Explicit connection ID (older CLIs)
+
+Before CLI 1.3.0, every non-Dataverse connector requires a **connection ID** (`-c`) when added via `pa app add data-source`. Without it, the command fails with: `CONNECTION_ID argument is required for connector data sources`.
+
+#### Step 1: List Existing Connections
Run the `/list-connections` skill. It runs `pa connection list` and returns a table of connection IDs and connector names.
-Look for the connector in the output. Note the **ConnectionId** column value.
+Look for the connector in the output. Note the **ConnectionId** column value. If there are several, ask the user which one to use.
-### Step 2: If No Connection Exists
+#### Step 2: If No Connection Exists
-The user must create one first:
+Create it with the CLI:
-1. Construct the direct Connections URL using the active environment ID from context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections`
-2. Share this link with the user and ask them to click **+ New connection**
-3. Search for and create the connector (e.g., "Office 365 Outlook", "Azure DevOps", "Teams")
-4. Complete the sign-in/consent flow
-5. Re-run `/list-connections` to get the new connection ID
+1. Ask the user to confirm, then run `pa connection create --connector <connector-id>` (`power-apps create-connection -a <connector-id>` on `power-apps`-only projects). Connectors whose only sign-in option is the user's Microsoft account are created silently, and the command prints the new connection ID.
+2. If the CLI says the connection needs a browser sign-in it can't do in non-interactive mode, follow [Create a connection with the user](#create-a-connection-with-the-user): the user runs the same command in their own terminal, with the maker portal as a fallback.
+3. Re-run `/list-connections` to get the new connection ID.
-### Step 3: Use Connection ID
+#### Step 3: Use Connection ID
Always pass `-c <connection-id>` when adding a connector:
@@ -33,7 +100,7 @@ Always pass `-c <connection-id>` when adding a connector:
# Non-tabular connectors
pa app add data-source --connector <api-name> -c <connection-id>
-# Tabular connectors (also need -d and -t)
+# Tabular connectors (also need -d and --table)
pa app add data-source --connector <api-name> -c <connection-id> -d '<dataset>' --table '<table>'
```
@@ -64,5 +131,6 @@ This avoids context window bloat and is much faster than reading entire generate
When a connector skill is invoked from another skill (e.g., `/create-code-app` calls `/add-office365`):
- **Check `$ARGUMENTS`** -- if provided, use it as the connector name or configuration
+- **Use a connection ID the caller passes** -- pass it with `-c` and skip connection lookup
- **Skip redundant questions** -- don't re-ask things the caller already provided (connector name, project path, etc.)
- **Memory bank is still read** -- but skip the summary if the caller just updated it
diff --git a/plugins/code-apps/shared/memory-bank.md b/plugins/code-apps/shared/memory-bank.md
index 20aaaca6b..dd92621e3 100644
--- a/plugins/code-apps/shared/memory-bank.md
+++ b/plugins/code-apps/shared/memory-bank.md
@@ -61,7 +61,7 @@ Update the memory bank immediately after completing each major step. This ensure
### What to Update
1. **Mark completed steps** with `[x]`
-2. **Record created resources** (data sources, connectors, files)
+2. **Record created resources** (data sources, connectors, files — never connection names or IDs)
3. **Save user decisions** (connector choice, table names, etc.)
4. **Update current status** and next step
5. **Add timestamp** to "Last Updated"
@@ -105,6 +105,7 @@ Update after:
| Environment ID | [ENVIRONMENT_GUID] |
| App URL | [APP_URL] |
| CLI Binary | [pa / power-apps] |
+| CLI Version | [e.g. 1.3.0] |
| Created Date | [DATE] |
| Status | [In Progress/Created/Deployed] |
@@ -228,6 +229,7 @@ When reading the memory bank, extract:
3. **Timestamp updates**: Always update "Last Updated"
4. **Preserve history**: Add to notes, don't overwrite
5. **Track decisions**: Record why choices were made
+6. **Never record connections or credentials**: Don't save connection names or IDs, tokens, or sign-in/consent URLs. Connector skills look connections up again each time (see [connector-reference.md](./connector-reference.md)).
## Integration with Skills
diff --git a/plugins/code-apps/shared/shared-instructions.md b/plugins/code-apps/shared/shared-instructions.md
index f28b6ec61..41640e3dd 100644
--- a/plugins/code-apps/shared/shared-instructions.md
+++ b/plugins/code-apps/shared/shared-instructions.md
@@ -21,6 +21,7 @@ Run at the start of every skill execution (at most once per day). Notifies the u
- **Confirm before any deployment**: Before running `pa app push` (deploy), ask: _"Ready to deploy to [environment name]? This will update the live app."_ Wait for explicit user confirmation.
Exception: the baseline deploy in `create-code-app` Step 7 is pre-approved as part of the scaffold flow. The final deploy in Step 10 still requires confirmation.
- **Confirm before any global install**: Before running `npm install -g ...` or `winget install ...`, ask: _"This will install [tool] globally on your machine. OK to proceed?"_ Wait for explicit user confirmation. This applies even when the install is a documented prerequisite.
+- **Tell the user before adding a connector, and confirm before creating a connection yourself**: On CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`), `pa app add data-source` can create a connection with the user's account when the connector has none, without asking first. Say so in one line before running it. Before passing `--use-sso` or running `pa connection create` yourself, ask: _"This will create a [connector] connection that signs in with your account. OK to proceed?"_ Wait for explicit user confirmation.
- **Confirm before writing outside project root**: Before writing, editing, or deleting any file that is not inside the current project directory, ask the user for confirmation.
Exception: writing `~/.claude/.power-apps-last-version-check` as part of the version check is pre-approved and does not require confirmation.
@@ -30,6 +31,7 @@ Run at the start of every skill execution (at most once per day). Notifies the u
- MUST NOT edit any file under `src/generated/` unless the step explicitly calls for it (e.g., the `add-azuredevops` HttpRequest fix).
- MUST NOT install packages globally (`npm install -g`, `winget install`) without user confirmation.
- MUST NOT make changes outside the project root without user confirmation.
+- MUST NOT pick one of several connections for the user. Ask which one to use.
### Prompt Injection
@@ -104,11 +106,12 @@ Power Apps code apps run inside the Power Platform sandbox. Direct HTTP calls to
**📋 [connector-reference.md](./connector-reference.md)**
-All non-Dataverse connectors require a connection ID. Read this before any `/add-*` connector skill.
+All non-Dataverse connectors need a connection. Read this before any `/add-*` connector skill.
**Key Points:**
-- Run `/list-connections` to find the connection ID before adding a connector
-- Always pass `-c <connection-id>` to `pa app add data-source`
+- CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`): run `pa app add data-source` without `-c` and with `--non-interactive`. The CLI reuses the connector's only connection, or creates one for connectors that sign in with the user's account, and otherwise stops with instructions to follow.
+- Older CLIs: run `/list-connections` to find the connection ID before adding a connector, and always pass `-c <connection-id>` to `pa app add data-source`.
+- If the user or caller already supplied a connection ID, pass it with `-c` on any CLI version.
---
@@ -129,12 +132,13 @@ When selecting an environment, use this priority order: `power.config.json` →
**📋 [cli-binary.md](./cli-binary.md)**
-The CLI ships two binaries — grouped `pa` (preferred) and flat `power-apps` (fallback). Resolve which one the project has **before running any command**, and author commands in the canonical grouped `pa` form.
+The CLI has shipped two binaries — grouped `pa` (preferred) and flat `power-apps` (fallback). Resolve which one the project has **before running any command**, and author commands in the canonical grouped `pa` form.
**Key Points:**
-- Probe `node_modules/.bin/pa` from the project root: if present use `pa` (grouped), else fall back to `power-apps` (flat). Cache the result in the memory bank.
+- Probe `node_modules/.bin/pa` from the project root: if present use `pa` (grouped), else fall back to `power-apps` (flat). If neither exists, install the CLI into the project as described in `cli-binary.md`. Cache the result in the memory bank.
- **Always** invoke via `npx --no-install <pa|power-apps>` — `--no-install` prevents npx from fetching an unrelated remote package.
- Author commands in the grouped form using the renamed `pa` flags (`pa app add data-source --connector <api> --table <table>`); if the project only has `power-apps`, translate **both the verb path and the renamed flags** to their flat equivalents (`--connector`→`--api-id`/`-a`, `--table`→`--resource-name`/`-t`) using the mapping tables in `cli-binary.md` before running. Most flags (`-c`, `-d`, `-e`) are unchanged.
+- Also set `PA_INLINE_CONNECTIONS` (`yes` for `pa` 1.3.0+). Connector skills use it to decide whether a connection ID is required.
---
@@ -145,7 +149,7 @@ for recognized CLI commands. Do not add manual attribution exports. Explicit
user-supplied values win; this attribution uses the CLI's existing telemetry
consent and `cliSource` common property, not a separate plugin telemetry stream.
-The Power Apps code app CLI (`@microsoft/power-apps-cli`) is installed locally as part of `npm install` when a project is scaffolded with the template. **Never invoke a bare `pa`/`power-apps`** — always run the locally-installed CLI through the resolved `$PA` prefix (`npx --no-install …`) from within the project directory. **Resolve the binary first (see [cli-binary.md](./cli-binary.md)); the commands below are canonical grouped `pa` templates — substitute `$PA` for the leading `pa`, and when `PA_KIND=power-apps` translate the verb path and renamed flags via the mapping tables before running.**
+The Power Apps code app CLI (`@microsoft/power-apps-cli`) is installed into each project as a dev dependency (the Vite template doesn't include it; see [cli-binary.md](./cli-binary.md)). **Never invoke a bare `pa`/`power-apps`** — always run the locally-installed CLI through the resolved `$PA` prefix (`npx --no-install …`) from within the project directory. **Resolve the binary first (see [cli-binary.md](./cli-binary.md)); the commands below are canonical grouped `pa` templates — substitute `$PA` for the leading `pa`, and when `PA_KIND=power-apps` translate the verb path and renamed flags via the mapping tables before running.**
**Core commands (canonical `pa` form — translate to flat `power-apps` via [cli-binary.md](./cli-binary.md) when only `power-apps` is installed):**
@@ -155,11 +159,14 @@ pa app push # Deploy app to Power Platform (
pa app run # Start local dev server
pa app add data-source --connector <api> [-c <conn-id>] [-d <dataset>] [--table <table>]
pa connection list # List connections in current environment
-pa connector list-datasets --connector <api> -c <conn-id> # List datasets for a connector
-pa connector list-tables --connector <api> -c <conn-id> -d <dataset> # List tables in a dataset
+pa connection create --connector <api> # Create a connection (browser sign-in unless single sign-on)
+pa connection list-datasets --connector <api> -c <conn-id> # List datasets for a connection
+pa connection list-tables --connector <api> -c <conn-id> -d <dataset> # List tables in a dataset
pa auth logout # Log out
```
+On CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`), `-c` is optional for connectors and `--use-sso` is available; see [connector-reference.md](./connector-reference.md).
+
**Authentication:** The CLI uses MSAL (browser-based login). On the first command that requires auth, a browser window opens for Microsoft sign-in. The token is cached for subsequent commands. No separate auth setup step is needed.
**Environment selection:** The environment ID is set once at `init` time and stored in `power.config.json`. There is no separate env select command. Users find their environment ID from make.powerapps.com (the GUID in the URL, e.g. `https://make.powerapps.com/environments/<env-id>/home`).
@@ -189,9 +196,10 @@ Apply these rules whenever a Power Apps CLI (`pa`/`power-apps`) or `npm` command
| Condition | Action |
| --- | --- |
-| Non-zero exit / error output | Report the exact error. STOP. Do not continue to the build step. |
-| "connectionId not found" or empty `-c` | Ask the user to run `/list-connections` to get a valid connection ID and retry. |
-| Auth error / token expired | Run `pa auth logout` (or `power-apps logout` on `power-apps`-only projects), then retry — the CLI will prompt re-authentication. |
+| CLI 1.3.0+ connection outcomes: several connections, a connection that can't be created automatically, `--use-sso` not supported, or a kept connection after a later failure | Follow the outcome table in [connector-reference.md](./connector-reference.md). These are expected stops, not fatal errors. |
+| "connectionId not found" or empty `-c` (older CLIs) | Ask the user to run `/list-connections` to get a valid connection ID and retry. |
+| Auth error / token expired | CLI 1.3.0+ with `--non-interactive` (exit 3): the CLI can't open a browser, so run `pa auth login`, then retry. Older CLIs: run `pa auth logout` (or `power-apps logout` on `power-apps`-only projects), then retry — the CLI will prompt re-authentication. |
+| Any other non-zero exit / error output | Report the exact error. STOP. Do not continue to the build step. |
**Example:**
> "The `pa app add data-source` command failed: `Error: connectionId 'abc123' not found in environment.` Please run `/list-connections` to confirm the connection exists and get the correct ID."
diff --git a/plugins/code-apps/skills/add-azuredevops/SKILL.md b/plugins/code-apps/skills/add-azuredevops/SKILL.md
index 8948a5060..7f6809ba8 100644
--- a/plugins/code-apps/skills/add-azuredevops/SKILL.md
+++ b/plugins/code-apps/skills/add-azuredevops/SKILL.md
@@ -22,12 +22,18 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
### Step 2: Add Connector
-**First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)):
+Get the connection as described in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections). The Azure DevOps connector's ID is `shared_visualstudioteamservices`.
-Run the `/list-connections` skill. Find the Azure DevOps connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
+**CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`):** tell the user that adding Azure DevOps may create a connection with their account, then run the add without `-c` and handle the result with the outcome table in connector-reference.md:
```bash
-pa app add data-source --connector azuredevops -c <connection-id>
+pa app add data-source --connector shared_visualstudioteamservices --non-interactive
+```
+
+**Older CLIs:** run `/list-connections` to find the Azure DevOps connection ID (if none exists, create one with `pa connection create` as described in connector-reference.md), then:
+
+```bash
+pa app add data-source --connector shared_visualstudioteamservices -c <connection-id>
```
### Step 3: Apply HttpRequest Fix (Required)
diff --git a/plugins/code-apps/skills/add-connector/SKILL.md b/plugins/code-apps/skills/add-connector/SKILL.md
index a72ec030a..699f18211 100644
--- a/plugins/code-apps/skills/add-connector/SKILL.md
+++ b/plugins/code-apps/skills/add-connector/SKILL.md
@@ -46,39 +46,54 @@ Otherwise, ask the user which connector they want to add. Browse available conne
| `teams` | `/add-teams` |
| `excelonlinebusiness` | `/add-excel` |
| `onedriveforbusiness` | `/add-onedrive` |
-| `azuredevops` | `/add-azuredevops` |
+| `visualstudioteamservices` | `/add-azuredevops` |
| `office365` | `/add-office365` |
| `commondataservice` | `/add-dataverse` |
+Match the API name with or without the `shared_` prefix (`pa connector list` shows it with the prefix, e.g. `shared_teams`).
+
Invoke the appropriate skill with the same `$ARGUMENTS` and **do not continue this skill's workflow**.
Common connector API names:
- `sharepointonline`, `teams`, `excelonlinebusiness`, `onedriveforbusiness`
-- `azuredevops`, `azureblob`, `azurequeues`
+- `visualstudioteamservices` (Azure DevOps), `azureblob`, `azurequeues`
- `office365`, `office365users`, `office365groups`
- `sql`, `commondataservice`
### Step 3: Add Connector
-**First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)):
-
-Run the `/list-connections` skill. Find the connector in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
+Get the connection as described in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections). On CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`), tell the user a connection may be created with their account, run the add without `-c` and with `--non-interactive`, and handle the result with the outcome table there. On older CLIs, run `/list-connections` first to find the connection ID (if none exists, create one with `pa connection create` as described in connector-reference.md) and pass `-c <connection-id>`.
```bash
-# Non-tabular connectors (Teams, Azure DevOps, etc.)
+# CLI 1.3.0+, connectors that only have actions (Teams, Office 365 Outlook, Azure DevOps, ...):
+# the CLI finds or creates the connection
+pa app add data-source --connector <connector-api-name> --non-interactive
+
+# CLI 1.3.0+, connectors that also support tables (SharePoint, SQL Server, Excel): choose
+# --as action (or a table, below). Without either, --non-interactive fails on the missing choice.
+pa app add data-source --connector <connector-api-name> --as action --non-interactive
+
+# Older CLIs: pass the connection ID
pa app add data-source --connector <connector-api-name> -c <connection-id>
-# Tabular connectors (SharePoint, Excel, SQL, etc.) -- also need dataset and table
+# Tables (SharePoint, Excel, SQL, etc.) on any CLI: dataset and table, plus the connection ID used to find them
pa app add data-source --connector <connector-api-name> -c <connection-id> -d '<dataset>' --table '<table>'
```
+To check whether a connector also supports tables, read `isTabular` from `pa connector list --search '<connector name>' --json`.
+
+Finding a table's dataset and name (`pa connection list-datasets` / `list-tables`) needs a connection ID: unlike `add data-source`, these commands don't find or create connections, and without `-c` they fail in non-interactive mode. So for tables, look the connection up first, even on CLI 1.3.0+ (`pa connection list --search <connector-api-name> --json`).
+
**Parameter reference:**
- `--connector` (apiId) -- connector name (e.g., `sharepointonline`, `teams`). On the flat `power-apps` binary this is `--api-id`/`-a`.
-- `-c` (connectionId) -- **required** for all non-Dataverse connectors. Get from `/list-connections`.
+- `-c` (connectionId) -- required on CLIs older than 1.3.0. On 1.3.0+ it's optional: without it the CLI reuses or creates the connection (see connector-reference.md). Get IDs from `/list-connections`.
- `-d` (dataset) -- required for tabular datasources (e.g., SharePoint site URL, SQL database). Not needed for Dataverse.
- `--table` (table) -- table/list name for tabular datasources (e.g., SharePoint list, Dataverse table logical name). On the flat `power-apps` binary this is `--resource-name`/`-t`.
+- `--as` -- `table` or `action`, for connectors that support both (CLI 1.2.0+). Use `--as action` to add the connector's actions instead of a table.
+- `--use-sso` -- use a single sign-on connection (CLI 1.3.0+). Ask the user first; see connector-reference.md.
+- `--non-interactive` -- the CLI never prompts; it fails with a message that says what's missing instead. Pass it on every add on CLI 1.3.0+: if the CLI runs in a real terminal, it would otherwise show prompts the agent can't answer, such as the connection picker when `-c` is omitted.
### Step 4: Inspect & Configure
diff --git a/plugins/code-apps/skills/add-mcscopilot/SKILL.md b/plugins/code-apps/skills/add-mcscopilot/SKILL.md
index e5fe5225f..2c8937932 100644
--- a/plugins/code-apps/skills/add-mcscopilot/SKILL.md
+++ b/plugins/code-apps/skills/add-mcscopilot/SKILL.md
@@ -22,9 +22,15 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
### Step 2: Add Connector
-**First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)):
+Get the connection as described in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections).
-Run the `/list-connections` skill. Find the Microsoft Copilot Studio connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
+**CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`):** tell the user that adding Microsoft Copilot Studio may create a connection with their account, then run the add without `-c` and handle the result with the outcome table in connector-reference.md:
+
+```bash
+pa app add data-source --connector microsoftcopilotstudio --non-interactive
+```
+
+**Older CLIs:** run `/list-connections` to find the Microsoft Copilot Studio connection ID (if none exists, create one with `pa connection create` as described in connector-reference.md), then:
```bash
pa app add data-source --connector microsoftcopilotstudio -c <connection-id>
diff --git a/plugins/code-apps/skills/add-office365/SKILL.md b/plugins/code-apps/skills/add-office365/SKILL.md
index bdcae9555..4f71577aa 100644
--- a/plugins/code-apps/skills/add-office365/SKILL.md
+++ b/plugins/code-apps/skills/add-office365/SKILL.md
@@ -22,9 +22,15 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
### Step 2: Add Connector
-**First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)):
+Get the connection as described in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections).
-Run the `/list-connections` skill. Find the Office 365 Outlook connection in the output (API name contains `office365`). If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
+**CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`):** tell the user that adding Office 365 Outlook may create a connection with their account, then run the add without `-c` and handle the result with the outcome table in connector-reference.md:
+
+```bash
+pa app add data-source --connector office365 --non-interactive
+```
+
+**Older CLIs:** run `/list-connections` to find the Office 365 Outlook connection ID (API name contains `office365`; if none exists, create one with `pa connection create` as described in connector-reference.md), then:
```bash
pa app add data-source --connector office365 -c <connection-id>
diff --git a/plugins/code-apps/skills/add-onedrive/SKILL.md b/plugins/code-apps/skills/add-onedrive/SKILL.md
index 74199728c..70de4e41f 100644
--- a/plugins/code-apps/skills/add-onedrive/SKILL.md
+++ b/plugins/code-apps/skills/add-onedrive/SKILL.md
@@ -22,9 +22,15 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
### Step 2: Add Connector
-**First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)):
+Get the connection as described in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections).
-Run the `/list-connections` skill. Find the OneDrive for Business connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
+**CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`):** tell the user that adding OneDrive for Business may create a connection with their account, then run the add without `-c` and handle the result with the outcome table in connector-reference.md:
+
+```bash
+pa app add data-source --connector onedriveforbusiness --non-interactive
+```
+
+**Older CLIs:** run `/list-connections` to find the OneDrive for Business connection ID (if none exists, create one with `pa connection create` as described in connector-reference.md), then:
```bash
pa app add data-source --connector onedriveforbusiness -c <connection-id>
@@ -34,39 +40,37 @@ pa app add data-source --connector onedriveforbusiness -c <connection-id>
Ask the user what file operations they need (list files, upload, download, create folder, etc.).
+The generated service is `OneDriveforBusinessService` (lowercase "for"), and its methods take positional parameters. Confirm names and signatures in `src/generated/services/` before using them.
+
**Common operations:**
```typescript
-// List files in a folder
-const files = await OneDriveForBusinessService.ListFolder({
- id: "root" // or folder ID
-});
-
-// Get file metadata
-const metadata = await OneDriveForBusinessService.GetFileMetadata({
- id: "file-id"
-});
-
-// Get file content
-const content = await OneDriveForBusinessService.GetFileContent({
- id: "file-id"
-});
-
-// Create file
-await OneDriveForBusinessService.CreateFile({
- folderPath: "/Documents",
- name: "report.txt",
- body: "File content here"
-});
+import { OneDriveforBusinessService } from "../generated/services/OneDriveforBusinessService";
+
+// List the files and folders in the root folder
+const root = await OneDriveforBusinessService.ListRootFolder();
+const rootItems = root.data ?? [];
+
+// List a subfolder by its Id (from an earlier listing); returns a page of items
+const folder = await OneDriveforBusinessService.ListFolderV2("<folder-id>");
+const folderItems = folder.data?.value ?? [];
+
+// Get file metadata and content
+const metadata = await OneDriveforBusinessService.GetFileMetadata("<file-id>");
+const content = await OneDriveforBusinessService.GetFileContent("<file-id>");
+
+// Create a file
+await OneDriveforBusinessService.CreateFile("/Documents", "report.txt", "File content here");
```
**Key points:**
-- File and folder IDs can be obtained from `ListFolder` or `ListRootFolder`
+- List the root folder with `ListRootFolder()` instead of passing `"root"` as a folder ID. `ListFolderV2` takes the `Id` of a folder returned by an earlier listing.
+- Use `ListFolderV2`, not `ListFolder`, which the connector has deprecated. `ListFolderV2` returns a page: the items are in `value`, and `nextLink` is set when there are more.
- Use `folderPath` for creating files by path, `id` for accessing existing files
- Binary file content may need base64 encoding/decoding depending on the operation
-Use `Grep` to find specific methods in `src/generated/services/OneDriveForBusinessService.ts` (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)).
+Use `Grep` to find specific methods in `src/generated/services/OneDriveforBusinessService.ts` (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)).
### Step 4: Build
diff --git a/plugins/code-apps/skills/add-sharepoint/SKILL.md b/plugins/code-apps/skills/add-sharepoint/SKILL.md
index 2fc5ffbf8..050743b04 100644
--- a/plugins/code-apps/skills/add-sharepoint/SKILL.md
+++ b/plugins/code-apps/skills/add-sharepoint/SKILL.md
@@ -20,7 +20,7 @@ Two paths: **existing lists** (skip to Step 6) or **new lists** (full workflow).
## Workflow
-1. Check Memory Bank → 2. Plan → 3. Setup Graph API Auth → 4. Review Existing Lists → 5. Create Lists → 6. Get Connection ID → 7. Discover Sites → 8. Discover Tables → 9. Add Connector → 10. Configure → 11. Build → 12. Update Memory Bank
+1. Check Memory Bank → 2. Plan → 3. Setup Graph API Auth → 4. Review Existing Lists → 5. Create Lists → 6. Get Connection ID → 7. Discover Sites → 8. Discover Tables → 9. Add Connector (tables and/or actions) → 10. Configure → 11. Build → 12. Update Memory Bank
---
@@ -84,22 +84,32 @@ Get explicit confirmation before creating. Use safe functions from [list-managem
### Step 6: Get Connection ID
-Find the SharePoint Online connection ID (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)):
+Discovering sites and lists (Steps 7–8) needs a SharePoint connection ID on every CLI version: `pa connection list-datasets` and `list-tables` don't find or create connections the way `pa app add data-source` does on CLI 1.3.0+ (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections)).
-Run the `/list-connections` skill. Find the SharePoint Online connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
+1. Run the `/list-connections` skill, filtered with `--search sharepointonline`.
+2. Exactly one SharePoint connection: use its connection ID. Several: ask the user which one to use.
+3. None: create one after asking the user.
+ - **CLI 1.3.0+:** SharePoint supports single sign-on, so with the user's OK run:
+
+ ```bash
+ pa connection create --connector shared_sharepointonline --use-sso
+ ```
+
+ It creates the connection silently with the user's account and prints `Connection ID: <id>`.
+ - **Older CLIs, or if the user wants a different sign-in type:** follow [Create a connection with the user](${PLUGIN_ROOT}/shared/connector-reference.md#create-a-connection-with-the-user), then repeat step 1.
### Step 7: Discover Sites
List available SharePoint sites the user has access to:
```bash
-pa connector list-datasets --connector sharepointonline -c <connection-id>
+pa connection list-datasets --connector sharepointonline -c <connection-id>
```
Present the sites to the user and ask which one(s) they want to connect to. If the user already specified a site URL, confirm it appears in the list.
-**If `pa connector list-datasets` fails or returns no results:**
-- Auth error: Run `pa auth logout` (or `power-apps logout` on `power-apps`-only projects), then retry — the CLI will re-prompt browser login.
+**If `pa connection list-datasets` fails or returns no results:**
+- Auth error: Run `pa auth login` (or `power-apps login` on `power-apps`-only projects), then retry.
- Empty list: Confirm the connection ID is for a SharePoint Online connection and the user has access to at least one site. STOP if the list is empty after confirming.
- Any other non-zero exit: Report the exact error output. STOP.
@@ -108,10 +118,10 @@ Present the sites to the user and ask which one(s) they want to connect to. If t
For each selected site, list the available lists and document libraries:
```bash
-pa connector list-tables --connector sharepointonline -c <connection-id> -d '<site-url>'
+pa connection list-tables --connector sharepointonline -c <connection-id> -d '<site-url>'
```
-**If `pa connector list-tables` fails or returns no results:**
+**If `pa connection list-tables` fails or returns no results:**
- Confirm the site URL from Step 7 is exact (copy from the output — do not retype).
- If still empty, the user may not have access to that site's lists. Ask them to verify permissions in SharePoint.
- Any other non-zero exit: Report the exact error output. STOP.
@@ -120,60 +130,61 @@ Present the tables to the user and ask which ones they want to add. Suggest tabl
### Step 9: Add Connector
-SharePoint is a tabular datasource -- requires `-c` (connection ID), `-d` (site URL), and `--table` (list name):
+SharePoint supports both tables and actions, so say which one you're adding. Pass the connection ID from Step 6, so the add doesn't need to look for a connection (on CLI 1.3.0+, also pass `--non-interactive`):
```bash
+# Lists and libraries as tables: -c (connection ID), -d (site URL), and --table (list name)
pa app add data-source --connector sharepointonline -c <connection-id> -d '<site-url>' --table '<table-name>'
+
+# Document library and file operations (CLI 1.2.0+): add the connector's actions
+pa app add data-source --connector sharepointonline -c <connection-id> --as action
```
-Run the command for each list or library the user selected. The `-d` (dataset) is the SharePoint site URL from Step 7, `--table` is the list/library name from Step 8.
+Run the table command for each list or library the user selected. The `-d` (dataset) is the SharePoint site URL from Step 7, `--table` is the list/library display name from Step 8. Add the actions only if the app needs file or folder operations; the CLI keeps them as a separate data source next to the tables.
### Step 10: Configure
**Read [sharepoint-reference.md](./references/sharepoint-reference.md) before writing any SharePoint code** -- column encoding, choice fields, and lookups have critical gotchas.
+What the CLI generates depends on how you added SharePoint in Step 9 (CLI 1.3.0):
+
+| Added with | Generated service | How you call it |
+| --- | --- | --- |
+| `--table '<list>'` | One service per list, named after it (for example `ProjectMilestonesService`), with `<List>Read` / `<List>Write` models | `getAll(options?)`, `get(id)`, `create(record)`, `update(id, changedFields)`, `delete(id)` |
+| `--as action` | `SharePointService` | The connector's operations, with **positional** parameters: `GetItems(dataset, table, ...)`, `PostItem(dataset, table, item)`, `ListRootFolder(dataset)`, `ListFolder(dataset, id)`, `GetFileContent(dataset, id)`, and more |
+
+These examples were verified against CLI 1.3.0. Grep `src/generated/services/` to confirm the service name and each method's exact signature before using it, especially in projects created with an older CLI.
+
**Common operations:**
```typescript
-// Get items from a SharePoint list
-const items = await SharePointOnlineService.GetItems({
- dataset: "https://contoso.sharepoint.com/sites/your-site",
- table: "Your List Name"
-});
-
-// Create a new list item
-await SharePointOnlineService.PostItem({
- dataset: "https://contoso.sharepoint.com/sites/your-site",
- table: "Your List Name",
- item: {
- Title: "New Item",
- Description: "Item description",
- Status: "Active"
- }
-});
-
-// Get files from a document library
-const files = await SharePointOnlineService.ListFolder({
- dataset: "https://contoso.sharepoint.com/sites/your-site",
- id: "Shared Documents" // Library name or folder ID
-});
-
-// Get file content
-const content = await SharePointOnlineService.GetFileContent({
- dataset: "https://contoso.sharepoint.com/sites/your-site",
- id: "file-server-relative-url"
-});
+// Lists added as tables: one typed service per list
+const result = await ProjectMilestonesService.getAll({ top: 50, orderBy: ["Title asc"] });
+const milestones = result.data ?? [];
+await ProjectMilestonesService.create({ Title: "New milestone" });
+await ProjectMilestonesService.update(id, { Title: "Renamed milestone" });
+
+// Connector actions (added with --as action) take positional parameters, for example
+// PostItem(dataset, table, item): dataset is the full site URL, table is the list's display name.
+const dataset = "https://contoso.sharepoint.com/sites/your-site";
+const items = await SharePointService.GetItems(dataset, "Your List Name");
+await SharePointService.PostItem(dataset, "Your List Name", { Title: "New Item", Status: "Active" });
+
+// Files in document libraries
+const root = await SharePointService.ListRootFolder(dataset);
+const files = await SharePointService.ListFolder(dataset, "<folder-id>");
+const content = await SharePointService.GetFileContent(dataset, "<file-id>");
```
**Key points:**
-- `dataset` is always the full SharePoint site URL
-- `table` is the list display name for list operations
+- `dataset` (action calls) is always the full SharePoint site URL
+- `table` (action calls) and `--table` (Step 9) take the list's display name
- List column names in the API may differ from display names (spaces become `_x0020_`, special chars encoded)
- Document library operations use folder/file IDs or server-relative URLs
- Choice columns use **string values**, not integer picklist codes (unlike Dataverse)
-Use `Grep` to find specific methods in `src/generated/services/SharePointOnlineService.ts` (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)).
+Use `Grep` to find specific methods in the generated services (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)).
### Step 11: Build
@@ -185,4 +196,4 @@ Fix TypeScript errors before proceeding. Do NOT deploy yet.
### Step 12: Update Memory Bank
-Update `memory-bank.md` with: connector added, site URL, lists/libraries configured (or created), build status.
+Update `memory-bank.md` with: connector added, site URL, lists/libraries configured (or created), build status. Don't record the connection ID.
diff --git a/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md b/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md
index 0bdd88b42..d29c9c8f4 100644
--- a/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md
+++ b/plugins/code-apps/skills/add-sharepoint/references/sharepoint-reference.md
@@ -66,24 +66,16 @@ const categoryArray = categories?.split(";") || [];
Lookup columns in SharePoint reference items from another list. In the generated services, they appear as objects with `Id` and `Value`:
```typescript
-// Reading a lookup column
-const item = await SharePointOnlineService.GetItem({
- dataset: siteUrl,
- table: "Tasks",
- id: itemId
-});
-// item.AssignedTo = { Id: 5, Value: "John Smith" }
-// item.Project = { Id: 12, Value: "Website Redesign" }
+// Reading a lookup column with the connector action GetItem(dataset, table, id):
+// dataset is the site URL, and SharePoint item IDs are integers
+const result = await SharePointService.GetItem(dataset, "Tasks", itemId);
+// result.data.AssignedTo = { Id: 5, Value: "John Smith" }
+// result.data.Project = { Id: 12, Value: "Website Redesign" }
// Creating/updating with a lookup -- use the ID
-await SharePointOnlineService.PatchItem({
- dataset: siteUrl,
- table: "Tasks",
- id: itemId,
- item: {
- AssignedToId: 5, // Use the Id suffix
- ProjectId: 12 // Use the Id suffix
- }
+await SharePointService.PatchItem(dataset, "Tasks", itemId, {
+ AssignedToId: 5, // Use the Id suffix
+ ProjectId: 12 // Use the Id suffix
});
```
@@ -100,7 +92,7 @@ await SharePointOnlineService.PatchItem({
| Error | Cause | Fix |
| ------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `"Column 'X' does not exist"` | Using display name instead of internal name | Check generated model for actual property name; may need `_x0020_` encoding |
-| `"The list 'X' does not exist"` | List name doesn't match exactly | Verify list display name via `pa connector list-tables`; names are case-sensitive |
+| `"The list 'X' does not exist"` | List name doesn't match exactly | Verify list display name via `pa connection list-tables`; names are case-sensitive |
| `"Value does not fall within the expected range"` | Invalid choice value or column type mismatch | Verify the exact choice option strings; SharePoint choices are case-sensitive |
| `"Item does not exist"` | Using wrong ID format or deleted item | SharePoint list item IDs are sequential integers, not GUIDs |
| `"Access denied"` | Insufficient SharePoint permissions | User needs at least Edit permission on the list |
@@ -127,46 +119,32 @@ await SharePointOnlineService.PatchItem({
## Generated Service Patterns
-After running `pa app add data-source --connector sharepointonline`, the generated `SharePointOnlineService.ts` provides methods that work across all connected lists. The `dataset` (site URL) and `table` (list name) parameters select which list to operate on:
-
-```typescript
-import { SharePointOnlineService } from "../generated/services/SharePointOnlineService";
-
-// List all items
-const result = await SharePointOnlineService.GetItems({
- dataset: "https://contoso.sharepoint.com/sites/mysite",
- table: "My List"
-});
-const items = result.value || [];
+What `pa app add data-source` generates depends on how SharePoint was added (CLI 1.3.0):
-// Get single item by ID (SharePoint IDs are integers)
-const item = await SharePointOnlineService.GetItem({
- dataset: siteUrl,
- table: "My List",
- id: 42
-});
+**Lists added as tables** (`--table '<list>'`): one service per list, named after it, with typed `<List>Read` / `<List>Write` models:
-// Create item
-const newItem = await SharePointOnlineService.PostItem({
- dataset: siteUrl,
- table: "My List",
- item: { Title: "New Item", Status: "Active" }
-});
+```typescript
+import { ProjectMilestonesService } from "../generated/services/ProjectMilestonesService";
+
+const result = await ProjectMilestonesService.getAll({ top: 50 });
+const items = result.data ?? [];
+const one = await ProjectMilestonesService.get(id);
+const created = await ProjectMilestonesService.create({ Title: "New Item" });
+await ProjectMilestonesService.update(id, { Title: "Updated" });
+await ProjectMilestonesService.delete(id);
+```
-// Update item
-await SharePointOnlineService.PatchItem({
- dataset: siteUrl,
- table: "My List",
- id: 42,
- item: { Status: "Completed" }
-});
+**Connector actions** (`--as action`): `SharePointService`, whose methods take positional parameters. The `dataset` (site URL) and `table` (list name) arguments select the list:
-// Delete item
-await SharePointOnlineService.DeleteItem({
- dataset: siteUrl,
- table: "My List",
- id: 42
-});
+```typescript
+import { SharePointService } from "../generated/services/SharePointService";
+
+const dataset = "https://contoso.sharepoint.com/sites/mysite"; // the site URL
+const list = await SharePointService.GetItems(dataset, "My List"); // optional: $filter, $orderby, $top, ...
+const item = await SharePointService.GetItem(dataset, "My List", 42); // SharePoint item IDs are integers
+const newItem = await SharePointService.PostItem(dataset, "My List", { Title: "New Item", Status: "Active" });
+await SharePointService.PatchItem(dataset, "My List", 42, { Status: "Completed" });
+await SharePointService.DeleteItem(dataset, "My List", 42);
```
-Use `Grep` to find specific methods in `src/generated/services/SharePointOnlineService.ts` (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)).
+These examples were verified against CLI 1.3.0. Use `Grep` on `src/generated/services/` to confirm service names and exact signatures, especially in projects created with an older CLI (generated files can be very large -- see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#inspecting-large-generated-files)).
diff --git a/plugins/code-apps/skills/add-teams/SKILL.md b/plugins/code-apps/skills/add-teams/SKILL.md
index 5c96f6476..1849819c2 100644
--- a/plugins/code-apps/skills/add-teams/SKILL.md
+++ b/plugins/code-apps/skills/add-teams/SKILL.md
@@ -22,9 +22,15 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
### Step 2: Add Connector
-**First, find the connection ID** (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md)):
+Get the connection as described in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections).
-Run the `/list-connections` skill. Find the Teams connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for the connector → Create.
+**CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`):** tell the user that adding Teams may create a connection with their account, then run the add without `-c` and handle the result with the outcome table in connector-reference.md:
+
+```bash
+pa app add data-source --connector teams --non-interactive
+```
+
+**Older CLIs:** run `/list-connections` to find the Teams connection ID (if none exists, create one with `pa connection create` as described in connector-reference.md), then:
```bash
pa app add data-source --connector teams -c <connection-id>
diff --git a/plugins/code-apps/skills/add-workiq/SKILL.md b/plugins/code-apps/skills/add-workiq/SKILL.md
index 5bdc2949f..84a7e7b6d 100644
--- a/plugins/code-apps/skills/add-workiq/SKILL.md
+++ b/plugins/code-apps/skills/add-workiq/SKILL.md
@@ -28,9 +28,21 @@ Check for `memory-bank.md` per [shared-instructions.md](${PLUGIN_ROOT}/shared/sh
### Step 2: Add Connector
-The Power Apps code-app CLI (`@microsoft/power-apps-cli`, invoked as `pa` or `power-apps` — resolve via [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md)) creates the connection and generates the typed service itself. Make sure the CLI is installed (`npm install`) and you are signed in (`pa auth status`, or `power-apps auth-status` on `power-apps`-only projects; it shares the same auth as the rest of the code-app skills).
+The Power Apps code-app CLI (`@microsoft/power-apps-cli`, invoked as `pa` or `power-apps` — resolve via [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md)) adds the data source and generates the typed service. Make sure the CLI is installed in the project (see cli-binary.md) and you are signed in (`pa auth status`, or `power-apps auth-status` on `power-apps`-only projects; it shares the same auth as the rest of the code-app skills).
-#### Find or Create the Connection
+Work IQ is a **non-tabular** connector (api id `shared_a365copilotchatmcp`, shown as **Work IQ Copilot MCP (Preview)**). Get its connection as described in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections).
+
+#### CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`)
+
+Tell the user that adding Work IQ may create a connection with their account, then run the add without `-c`:
+
+```bash
+pa app add data-source --connector shared_a365copilotchatmcp --non-interactive
+```
+
+Handle the result with the outcome table in connector-reference.md. Work IQ supports single sign-on, so when the user has no Work IQ connection the CLI either creates one itself or suggests `--use-sso`; with the user's OK, re-run with `--use-sso`.
+
+#### Older CLIs: Find or Create the Connection
**Check for an existing connection first:**
@@ -38,32 +50,32 @@ The Power Apps code-app CLI (`@microsoft/power-apps-cli`, invoked as `pa` or `po
pa connection list
```
-Look for a **Work IQ Copilot MCP (Preview)** connection (api id `shared_a365copilotchatmcp`) in the output. If one is listed, note its Connection ID and skip to "Add the Data Source" below.
+Look for a **Work IQ Copilot MCP (Preview)** connection (api id `shared_a365copilotchatmcp`) in the output. If one is listed, note its Connection ID and skip to "Older CLIs: Add the Data Source" below.
-**Otherwise create one** with the native `create-connection` verb:
+**Otherwise create one**, after asking the user, with the native `create-connection` verb:
```bash
pa connection create --connector shared_a365copilotchatmcp
```
- The environment is read automatically from the app's `power.config.json` — you do **not** need to pass an environment id.
-- This connector requires OAuth, so the CLI **opens a browser to complete sign-in/consent** (SSO-only connectors complete silently with no browser).
+- If the connection needs a browser sign-in, the CLI can only do that from an interactive terminal. If it says so, follow [Create a connection with the user](${PLUGIN_ROOT}/shared/connector-reference.md#create-a-connection-with-the-user): the user runs the same command in their own terminal.
- On success it prints the **Connection ID** — save it for the next step.
-**STOP HERE — interactive sign-in required:**
+**STOP HERE if a browser sign-in is needed:**
-1. Tell the user the browser has opened (or share the URL the CLI prints).
+1. Tell the user the browser has opened (or ask them to run the command in their own terminal).
2. Ask them to sign in with their Microsoft 365 account and grant consent to the **Work IQ Copilot MCP** connector.
3. **Wait for the user to confirm** the browser shows success before continuing.
**If `create-connection` fails:**
-- "not signed in" / auth error → run `pa auth status` (or `power-apps auth-status` on `power-apps`-only projects), sign in if needed, and retry.
+- "not signed in" / auth error → run `pa auth login` (or `power-apps login` on `power-apps`-only projects), then retry.
- "Connection creation was cancelled." → the browser flow was closed early; re-run and complete it.
- Any other non-zero exit → report the exact error and STOP.
As a fallback, the user can create the connection manually in the maker portal: `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection** → search for "Work IQ Copilot MCP" → Create, then re-run `list-connections`.
-#### Add the Data Source
+#### Older CLIs: Add the Data Source
Once the connection exists, add it to the code app (this is what generates the typed service + model):
diff --git a/plugins/code-apps/skills/create-code-app/SKILL.md b/plugins/code-apps/skills/create-code-app/SKILL.md
index cf8c2f533..4b54f2d7a 100644
--- a/plugins/code-apps/skills/create-code-app/SKILL.md
+++ b/plugins/code-apps/skills/create-code-app/SKILL.md
@@ -86,6 +86,7 @@ Ask the user for a folder name. Default to `powerapps-{app-name-slugified}-{time
npx degit microsoft/PowerAppsCodeApps/templates/vite {folder} --force
cd {folder}
npm install
+npm install --save-dev "@microsoft/power-apps-cli@^1.3.0"
```
**Notes:**
@@ -93,8 +94,9 @@ npm install
- Use `--force` to overwrite if the directory already has files (e.g., `.claude` from a planning session)
- If targeting an existing directory, use `.` as the folder name: `npx degit microsoft/PowerAppsCodeApps/templates/vite . --force`
- If `npx degit` fails (network issues, npm not found), retry once, then ask the user to run manually
+- The template doesn't include the Power Apps CLI, so install it into the project as a dev dependency (not globally). Version 1.3.0 or later lets the connector skills find or create connections without asking for a connection ID.
-Verify: `package.json` exists, `node_modules/` created.
+Verify: `package.json` exists, `node_modules/` created, and `@microsoft/power-apps-cli` is listed in `devDependencies`. Then resolve the CLI per [cli-binary.md](${PLUGIN_ROOT}/shared/cli-binary.md); it should resolve to `pa` with `PA_INLINE_CONNECTIONS=yes`.
### Step 5: Initialize
@@ -165,6 +167,8 @@ Invoke the `/add-*` skills identified in the plan (Step 3). Run each in sequence
| Search M365 data or get AI-powered answers | `/add-workiq` |
| Connect to another service | `/add-connector` |
+**Connections:** every connector except Dataverse needs a connection. With the CLI 1.3.0+ installed in Step 4, the connector skills find or create it themselves: they tell the user first that a connection may be created with the user's account, and ask before running `--use-sso` or `pa connection create`. See [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections).
+
Each `/add-*` skill runs `npm run build` to catch errors. Do NOT deploy yet.
**If no data sources needed:** Skip to Step 8.
@@ -251,6 +255,7 @@ node --version # → v22.4.0
npx degit microsoft/PowerAppsCodeApps/templates/vite powerapps-task-tracker-20260302 --force
cd powerapps-task-tracker-20260302
npm install
+npm install --save-dev "@microsoft/power-apps-cli@^1.3.0"
# Step 5: Initialize (browser login prompt on first run; CLI prompts for env ID if -e omitted)
pa app init -n 'Task Tracker' -e <environment-id>
@@ -273,13 +278,14 @@ pa app push
| File | Change |
| --------------------------------------------- | ----------------------------------------------------- |
+| `package.json` | Updated — adds `@microsoft/power-apps-cli` to `devDependencies` |
| `power.config.json` | Created by `pa app init` — contains `environmentId` |
-| `src/generated/models/Cr123_taskModel.ts` | Generated by `pa app add data-source` |
-| `src/generated/services/Cr123_taskService.ts` | Generated by `pa app add data-source` |
+| `src/generated/models/Cr123_tasksModel.ts` | Generated by `pa app add data-source`, named after the table's entity set name (here `cr123_tasks`) |
+| `src/generated/services/Cr123_tasksService.ts` | Generated by `pa app add data-source` |
| `src/components/TaskList.tsx` | Created — renders task list with status filter |
| `src/components/AddTaskForm.tsx` | Created — form to add new tasks |
-| `src/App.tsx` | Updated — wires components to `Cr123_taskService` |
-| `memory-bank.md` | Created in Step 7, updated in Step 11 |
+| `src/App.tsx` | Updated — wires components to `Cr123_tasksService` |
+| `memory-bank.md` | Created in Step 6, updated at the end |
**Final assistant summary (verbatim format):**
@@ -315,6 +321,7 @@ What you can add next:
- App name: Task Tracker
- Environment: <your-environment-name> (<environment-id>)
- App URL: https://apps.powerapps.com/play/e/<environment-id>/app/<app-id>
+- CLI: pa 1.3.0
## Completed Steps
@@ -351,20 +358,20 @@ What you can add next:
**Commands run (in order):**
```bash
-# Step 6: Get connection ID (via /list-connections)
-pa connection list
-# → ConnectionId: conn-sp-xyz789 (SharePoint Online)
+# Step 6: Get the connection ID (via /list-connections)
+pa connection list --search sharepointonline
+# → one SharePoint connection: conn-sp-xyz789
# Step 7: Discover sites
-pa connector list-datasets --connector sharepointonline -c conn-sp-xyz789
+pa connection list-datasets --connector sharepointonline -c conn-sp-xyz789
# → https://contoso.sharepoint.com/sites/Projects
# Step 8: Discover tables
-pa connector list-tables --connector sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects'
+pa connection list-tables --connector sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects'
# → Project Milestones, Documents, Team Wiki
-# Step 9: Add connector
-pa app add data-source --connector sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects' --table 'Project Milestones'
+# Step 9: Add the list as a table
+pa app add data-source --connector sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects' --table 'Project Milestones' --non-interactive
# Step 11: Build to verify
npm run build # → success
@@ -372,12 +379,13 @@ npm run build # → success
**Files changed:**
-| File | Change |
-| --------------------------------------------------- | ------------------------------------------------- |
-| `src/generated/services/SharePointOnlineService.ts` | Generated — contains `GetItems`, `PostItem`, etc. |
-| `src/generated/models/SharePointOnlineModel.ts` | Generated — TypeScript interfaces |
-| `.power/schemas/sharepointonline/` | Generated schema files |
-| `memory-bank.md` | Updated — connector recorded |
+| File | Change |
+| ---------------------------------------------------- | ----------------------------------------------------------------------- |
+| `src/generated/services/ProjectMilestonesService.ts` | Generated — `getAll`, `get`, `create`, `update`, `delete` for the list |
+| `src/generated/models/ProjectMilestonesModel.ts` | Generated — `ProjectMilestonesRead` / `ProjectMilestonesWrite` types |
+| `.power/schemas/sharepointonline/` | Generated schema files |
+| `power.config.json` | Updated — the new data source and its connection reference |
+| `memory-bank.md` | Updated — connector recorded (no connection ID) |
**Final assistant summary (verbatim format):**
@@ -390,11 +398,8 @@ List: Project Milestones
Build: Passed ✓
Usage:
- const result = await SharePointOnlineService.GetItems({
- dataset: "https://contoso.sharepoint.com/sites/Projects",
- table: "Project Milestones"
- });
- const milestones = result.data?.value || [];
+ const result = await ProjectMilestonesService.getAll({ top: 50 });
+ const milestones = result.data ?? [];
Next: Implement your UI components using the generated service, then run /deploy when ready.
```
diff --git a/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md b/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md
index cdb47d8f7..b42d16ab6 100644
--- a/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md
+++ b/plugins/code-apps/skills/create-code-app/references/prerequisites-reference.md
@@ -2,12 +2,13 @@
## Required Tools
-| Tool | Minimum Version | Check Command | Install |
-| -------------- | --------------- | ---------------- | ---------------------- |
-| Node.js | **v22+** | `node --version` | https://nodejs.org/ |
-| Git (optional) | Any | `git --version` | https://git-scm.com/ |
+| Tool | Minimum Version | Check Command | Install |
+| ----------------- | --------------- | ------------------------------ | ----------------------------------------------- |
+| Node.js | **v22+** | `node --version` | https://nodejs.org/ |
+| Git (optional) | Any | `git --version` | https://git-scm.com/ |
+| Power Apps CLI | **1.3.0+** for new projects | `npx --no-install pa --version` | Installed per project by `/create-code-app` |
-The Power Apps CLI (`@microsoft/power-apps-cli`) is installed automatically as part of `npm install` when the project is scaffolded from the template. No separate CLI install is required.
+The Power Apps CLI (`@microsoft/power-apps-cli`) is installed into each project as a dev dependency during scaffolding (`/create-code-app` Step 4). The Vite template doesn't include it, and no global install is required. New projects get 1.3.0 or later, which lets connector skills find or create connections without a connection ID. Existing projects on an older CLI keep working with an explicit connection ID.
## Required Account
@@ -25,10 +26,12 @@ When using plan mode, include these in `allowedPrompts`:
{ "tool": "Bash", "prompt": "check tool versions (node, git)" },
{ "tool": "Bash", "prompt": "scaffold power apps template (npx degit)" },
{ "tool": "Bash", "prompt": "install npm dependencies" },
+ { "tool": "Bash", "prompt": "install the Power Apps CLI into the project (npm install --save-dev @microsoft/power-apps-cli)" },
{ "tool": "Bash", "prompt": "build for production (npm run build)" },
{ "tool": "Bash", "prompt": "initialize power apps project (pa app init)" },
- { "tool": "Bash", "prompt": "list connections (pa connection list)" },
+ { "tool": "Bash", "prompt": "list connections, datasets, and tables (pa connection list, list-datasets, list-tables)" },
{ "tool": "Bash", "prompt": "add data sources (pa app add data-source)" },
+ { "tool": "Bash", "prompt": "create connections (pa connection create)" },
{ "tool": "Bash", "prompt": "deploy to power platform (pa app push)" }
]
}
diff --git a/plugins/code-apps/skills/create-code-app/references/troubleshooting.md b/plugins/code-apps/skills/create-code-app/references/troubleshooting.md
index 75dcb9780..e0a8b3f65 100644
--- a/plugins/code-apps/skills/create-code-app/references/troubleshooting.md
+++ b/plugins/code-apps/skills/create-code-app/references/troubleshooting.md
@@ -26,6 +26,14 @@
| DNS/network error | Try different environment or contact admin. |
| Auth error / token expired | Run `pa auth logout`, then retry `pa app push` — CLI will prompt re-authentication via browser. On `power-apps`-only projects use `power-apps logout` then `power-apps push`. |
+## Connection and Data Source Errors
+
+| Problem | Solution |
+| ------- | -------- |
+| `pa app add data-source` stops with a connection message (several connections, a connection it can't create automatically, `--use-sso` not supported, or a connection kept after a failure) | Follow the outcome table in [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections) (CLI 1.3.0+). |
+| `Missing required option --connection-id` from `pa connection list-datasets` or `list-tables` | These commands always need a connection ID. Get it with `pa connection list --search <connector>`. |
+| A connector call in the running app fails with status 442: `Request blocked due to data loss prevention (DLP) or advanced connector policies (ACP)` | A data policy in the environment blocks that connector or action. Adding the data source still succeeds; the block only appears when the app calls it. Ask a Power Platform admin to allow it, or use a different environment or connector. |
+
## Resources
**Docs:**
diff --git a/plugins/code-apps/skills/list-connections/SKILL.md b/plugins/code-apps/skills/list-connections/SKILL.md
index 91be30d57..bb08cf10e 100644
--- a/plugins/code-apps/skills/list-connections/SKILL.md
+++ b/plugins/code-apps/skills/list-connections/SKILL.md
@@ -1,6 +1,6 @@
---
name: list-connections
-description: Lists Power Platform connections in the current environment. Use when you need a connection ID before adding a connector to a code app.
+description: Lists Power Platform connections in the current environment. Use when you need a connection ID before adding a connector to a code app (required on Power Apps CLI versions before 1.3.0), to choose between several connections, or to troubleshoot a connection.
user-invocable: true
allowed-tools: Bash
model: haiku
@@ -12,6 +12,8 @@ model: haiku
Lists all Power Platform connections in the current environment using the Power Apps CLI.
+On CLI 1.3.0+ (`PA_INLINE_CONNECTIONS=yes`), connector skills don't need this first: `pa app add data-source` finds or creates the connection itself (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections)). Use this skill there to choose between several connections or to check what exists. On older CLIs it's the required first step before adding a connector.
+
## Workflow
1. Fetch Connections → 2. Present Results
@@ -26,7 +28,9 @@ Lists all Power Platform connections in the current environment using the Power
pa connection list
```
-If the CLI is not authenticated, it will open a browser for login automatically. Complete the login and retry.
+To show only one connector's connections, add `--search '<connector name or ID>'`.
+
+If the CLI reports that you're not signed in, run `pa auth login` (it opens the browser for sign-in), then retry.
**Other failures:**
- Non-zero exit for any reason other than auth: Report the exact output. STOP.
@@ -34,10 +38,10 @@ If the CLI is not authenticated, it will open a browser for login automatically.
### Step 2: Present Results
-Show the connection list to the user. The **Connection ID** is what goes into `-c <connection-id>` when adding a data source.
+Show the connection list to the user. The **Connection ID** is what goes into `-c <connection-id>` when adding a data source. If the connector has several connections, let the user choose; don't pick one for them.
-**If the needed connector is missing:**
+**If the needed connector has no connection:**
-1. Share the direct Connections URL using the active environment ID from context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection**
-2. Search for and create the connector, then complete the sign-in/consent flow
-3. Re-run `/list-connections` to get the new connection ID
+1. On CLI 1.3.0+, the connector's `/add-*` skill usually handles this: the add creates single sign-on connections itself, and otherwise hands creation to the user (see [connector-reference.md](${PLUGIN_ROOT}/shared/connector-reference.md#connections)).
+2. To create one now, confirm with the user, then run `pa connection create --connector <connector-id>` yourself (`power-apps create-connection -a <connector-id>` on `power-apps`-only projects). Connectors whose only sign-in option is the user's Microsoft account are created silently. If the CLI says the connection needs a browser sign-in it can't do here, ask the user to run the same command in their own terminal from the project folder (or `npx --no-install pa connection create --connector <connector-id>` if `pa` isn't recognized). As a last resort, share the Connections URL using the active environment ID from context (from `power.config.json` or a prior step): `https://make.powerapps.com/environments/<environment-id>/connections` → **+ New connection**.
+3. Re-run `/list-connections` to get the new connection ID.