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.

[Pages] Allow az auth without an Azure subscription (#132)

Priyanshu Agrawal260127ab0cd7
diff --git a/plugins/power-pages/AGENTS.md b/plugins/power-pages/AGENTS.md
index 6c0afb798..f1abc77fd 100644
--- a/plugins/power-pages/AGENTS.md
+++ b/plugins/power-pages/AGENTS.md
@@ -14,6 +14,7 @@ Read `PLUGIN_DEVELOPMENT_GUIDE.md` for UX and reliability standards when creatin
- **Power Pages config loading** must reuse `scripts/lib/powerpages-config.js` anywhere a script reads `.powerpages-site` table-permission or site-setting YAML. Keep that module focused on loading/parsing code-site config only; put validation or business rules in separate validator modules.
- **Script changes require tests** — Whenever you add a new script or modify an existing script, add or update `node:test` coverage under `scripts/tests/`. Prefer one `*.test.js` file per script/module being tested, and keep the test command passing: `node --test plugins/power-pages/scripts/tests/` (Node's built-in runner discovers `*.test.js` files under the given directory). Validator changes are not an exception; they must always ship with test coverage.
- **Dataverse-backed validation** must stay opt-in for local runs only. Do not require live Dataverse connectivity in CI workflows or default test runs; gate it behind explicit local flags such as `--validate-dataverse-relationships`.
+- **Azure CLI `--allow-no-subscriptions`** — pass this flag on AAD-only `az` operations (`az account get-access-token`, `az login`, `az account show`) so the plugin works for users whose Microsoft account has no Azure subscription. Do NOT add it to subscription-scoped commands (`az keyvault create|list`, `az group ...`, `az resource ...`) — those genuinely require a subscription. Reuse the shared `getAuthToken` helper in `scripts/lib/validation-helpers.js` instead of shelling out to `az` directly.
- **Reference docs** shared across skills live in `references/` — reference via `${CLAUDE_PLUGIN_ROOT}/references/` paths, don't duplicate.
- **Templates** use `__PLACEHOLDER__` tokens (e.g., `__SITE_NAME__`) replaced during scaffolding. The `gitignore` file is stored without the dot prefix and renamed to `.gitignore` during scaffolding.
- **Hooks** are defined centrally in `hooks/hooks.json`, using `PostToolUse` with matcher `Skill` so validation runs when a tracked Power Pages skill completes.
diff --git a/plugins/power-pages/agents/data-model-architect.md b/plugins/power-pages/agents/data-model-architect.md
index 29d11477e..3851c0504 100644
--- a/plugins/power-pages/agents/data-model-architect.md
+++ b/plugins/power-pages/agents/data-model-architect.md
@@ -93,7 +93,7 @@ Verify Dataverse access and obtain authentication details using the shared scrip
node "${CLAUDE_PLUGIN_ROOT}/scripts/verify-dataverse-access.js" <envUrl>
```
-This outputs JSON with `token`, `userId`, `organizationId`, and `tenantId`. If it fails, inform the user that Azure CLI login is required (`az login`).
+This outputs JSON with `token`, `userId`, `organizationId`, and `tenantId`. If it fails, inform the user that Azure CLI login is required (`az login --allow-no-subscriptions` — works whether or not the user has an Azure subscription).
### 2.3 Query Existing Tables
@@ -148,7 +148,7 @@ If still unable to determine the prefix, use `cr` as a placeholder and note in t
If any of the above commands fail, include the error in your plan output so the user can see what went wrong:
- If `pac env who` fails: Note that PAC CLI auth is required (`pac auth create`)
-- If `verify-dataverse-access.js` fails: Note that Azure CLI login is required (`az login`)
+- If `verify-dataverse-access.js` fails: Note that Azure CLI login is required (`az login --allow-no-subscriptions`)
- If `dataverse-request.js` returns a non-2xx `status`: Check the status code — 401/403 means permissions are insufficient, 404 means the environment URL or API path may be incorrect
- The `dataverse-request.js` script handles 401 token refresh and 429/5xx retries automatically
diff --git a/plugins/power-pages/agents/table-permissions-architect.md b/plugins/power-pages/agents/table-permissions-architect.md
index 7111a9a97..8c708b5a4 100644
--- a/plugins/power-pages/agents/table-permissions-architect.md
+++ b/plugins/power-pages/agents/table-permissions-architect.md
@@ -378,7 +378,7 @@ Result:
If any API calls fail:
- **`pac env who` fails**: Note that PAC CLI auth is required (`pac auth create`)
-- **`verify-dataverse-access.js` fails**: Note that Azure CLI login is required (`az login`)
+- **`verify-dataverse-access.js` fails**: Note that Azure CLI login is required (`az login --allow-no-subscriptions`)
- **OData 401/403**: The `dataverse-request.js` script handles 401 token refresh automatically; persistent 401/403 indicates insufficient privileges — note in plan
- **OData 404**: Table doesn't exist — exclude from plan
diff --git a/plugins/power-pages/agents/webapi-settings-architect.md b/plugins/power-pages/agents/webapi-settings-architect.md
index 94632690b..76ef34bae 100644
--- a/plugins/power-pages/agents/webapi-settings-architect.md
+++ b/plugins/power-pages/agents/webapi-settings-architect.md
@@ -238,7 +238,7 @@ Store the results as a lookup map for each table:
If any API calls fail:
- **`pac env who` fails**: Note that PAC CLI auth is required (`pac auth create`)
-- **`verify-dataverse-access.js` fails**: Note that Azure CLI login is required (`az login`)
+- **`verify-dataverse-access.js` fails**: Note that Azure CLI login is required (`az login --allow-no-subscriptions`)
- **OData 401/403**: Token expired or insufficient privileges — note in plan
- **OData 404**: Table doesn't exist — exclude from plan
diff --git a/plugins/power-pages/references/dataverse-prerequisites.md b/plugins/power-pages/references/dataverse-prerequisites.md
index 363b249ce..fed83fbb4 100644
--- a/plugins/power-pages/references/dataverse-prerequisites.md
+++ b/plugins/power-pages/references/dataverse-prerequisites.md
@@ -24,4 +24,6 @@ Run the shared script to obtain an Azure CLI token and verify Dataverse API acce
node "${CLAUDE_PLUGIN_ROOT}/scripts/verify-dataverse-access.js" <envUrl>
```
-On success (exit 0), it outputs JSON to stdout with `token`, `userId`, `organizationId`, and `tenantId`. On failure (exit 1), stderr explains the issue (missing `az login`, expired token, etc.).
+On success (exit 0), it outputs JSON to stdout with `token`, `userId`, `organizationId`, and `tenantId`. On failure (exit 1), stderr explains the issue (missing `az login --allow-no-subscriptions`, expired token, etc.).
+
+> **Note for users without an Azure subscription**: Dataverse and Power Platform tokens are AAD-scoped, so they work even when the signed-in Microsoft account has no Azure subscriptions attached. Use `az login --allow-no-subscriptions` to authenticate — it succeeds in both cases. Subscription-scoped Azure operations (Key Vault, resource groups, etc.) still require an actual subscription.
diff --git a/plugins/power-pages/scripts/clear-site-cache.js b/plugins/power-pages/scripts/clear-site-cache.js
index df3fbfd8b..521c52e76 100644
--- a/plugins/power-pages/scripts/clear-site-cache.js
+++ b/plugins/power-pages/scripts/clear-site-cache.js
@@ -53,7 +53,7 @@ const ppApiBaseUrl = CLOUD_TO_API[pacInfo.cloud] || CLOUD_TO_API['Public'];
// --- Get Power Platform API token ---
const token = getAuthToken(ppApiBaseUrl);
if (!token) {
- output({ success: false, error: 'Failed to get Azure CLI access token. Ensure you are logged in with: az login' });
+ output({ success: false, error: 'Failed to get Azure CLI access token. Ensure you are logged in with: az login --allow-no-subscriptions' });
}
// --- Find the website and restart it to clear cache ---
diff --git a/plugins/power-pages/scripts/create-environment-variable.js b/plugins/power-pages/scripts/create-environment-variable.js
index 27fc6aa12..ffb1516b4 100644
--- a/plugins/power-pages/scripts/create-environment-variable.js
+++ b/plugins/power-pages/scripts/create-environment-variable.js
@@ -97,7 +97,7 @@ async function apiPost(envUrl, token, entitySet, body) {
async function main() {
const token = getAuthToken(envUrl);
if (!token) {
- process.stderr.write('Failed to get Azure CLI token. Run `az login` first.\n');
+ process.stderr.write('Failed to get Azure CLI token. Run `az login --allow-no-subscriptions` first.\n');
process.exit(1);
}
diff --git a/plugins/power-pages/scripts/dataverse-request.js b/plugins/power-pages/scripts/dataverse-request.js
index ef53c3223..978b1202a 100644
--- a/plugins/power-pages/scripts/dataverse-request.js
+++ b/plugins/power-pages/scripts/dataverse-request.js
@@ -76,7 +76,7 @@ async function main() {
let token = getAuthToken(envUrl);
if (!token) {
- process.stderr.write('Failed to get Azure CLI token. Run `az login` first.\n');
+ process.stderr.write('Failed to get Azure CLI token. Run `az login --allow-no-subscriptions` first.\n');
process.exit(1);
}
@@ -94,7 +94,7 @@ async function main() {
if (res.statusCode === 401 && attempt < maxRetries) {
token = getAuthToken(envUrl);
if (!token) {
- process.stderr.write('Token refresh failed. Run `az login` again.\n');
+ process.stderr.write('Token refresh failed. Run `az login --allow-no-subscriptions` again.\n');
process.exit(1);
}
continue;
diff --git a/plugins/power-pages/scripts/lib/validation-helpers.js b/plugins/power-pages/scripts/lib/validation-helpers.js
index eff59f614..123078e1d 100644
--- a/plugins/power-pages/scripts/lib/validation-helpers.js
+++ b/plugins/power-pages/scripts/lib/validation-helpers.js
@@ -94,12 +94,13 @@ const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12
/**
* Gets an Azure CLI access token for the given resource URL.
+ * `--allow-no-subscriptions` lets accounts without an Azure subscription mint AAD-scoped Dataverse/PP tokens.
* @returns {string|null} Access token, or null if unavailable
*/
function getAuthToken(resourceUrl) {
try {
return execSync(
- `az account get-access-token --resource "${resourceUrl}" --query accessToken -o tsv`,
+ `az account get-access-token --resource "${resourceUrl}" --allow-no-subscriptions --query accessToken -o tsv`,
{ encoding: 'utf8', timeout: 15000 }
).trim();
} catch {
diff --git a/plugins/power-pages/scripts/list-azure-keyvaults.js b/plugins/power-pages/scripts/list-azure-keyvaults.js
index 806decb66..ba862e35f 100644
--- a/plugins/power-pages/scripts/list-azure-keyvaults.js
+++ b/plugins/power-pages/scripts/list-azure-keyvaults.js
@@ -28,7 +28,7 @@ function main() {
}
if (result.status !== 0) {
- process.stderr.write('Failed to list Azure Key Vaults. Ensure you are logged in (`az login`).\n');
+ process.stderr.write('Failed to list Azure Key Vaults. Ensure `az login` succeeded AND your account has a subscription with Key Vault access (Key Vaults are subscription-scoped).\n');
if (result.stderr) process.stderr.write(result.stderr);
process.exit(1);
}
diff --git a/plugins/power-pages/scripts/list-custom-actions.js b/plugins/power-pages/scripts/list-custom-actions.js
index 770297af7..8ecaf635c 100644
--- a/plugins/power-pages/scripts/list-custom-actions.js
+++ b/plugins/power-pages/scripts/list-custom-actions.js
@@ -166,7 +166,7 @@ async function main() {
const token = getAuthToken(cleanUrl);
if (!token) {
process.stderr.write(
- 'Failed to get Azure CLI token. Run `az login` first.\n'
+ 'Failed to get Azure CLI token. Run `az login --allow-no-subscriptions` first.\n'
);
process.exit(1);
}
diff --git a/plugins/power-pages/scripts/tests/validation-helpers.test.js b/plugins/power-pages/scripts/tests/validation-helpers.test.js
new file mode 100644
index 000000000..5e446ed0e
--- /dev/null
+++ b/plugins/power-pages/scripts/tests/validation-helpers.test.js
@@ -0,0 +1,39 @@
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const path = require('path');
+
+const helpersPath = path.join(__dirname, '..', 'lib', 'validation-helpers.js');
+const childProcessId = require.resolve('child_process');
+
+test('getAuthToken passes --allow-no-subscriptions to az', () => {
+ const originalChildProcess = require.cache[childProcessId];
+ let capturedCommand = null;
+
+ require.cache[childProcessId] = {
+ id: childProcessId,
+ filename: childProcessId,
+ loaded: true,
+ exports: {
+ execSync: (command, options) => {
+ capturedCommand = command;
+ const out = 'fake-token-value\n';
+ return options && options.encoding ? out : Buffer.from(out);
+ },
+ },
+ };
+ delete require.cache[require.resolve(helpersPath)];
+
+ try {
+ const { getAuthToken } = require(helpersPath);
+ const token = getAuthToken('https://example.crm.dynamics.com');
+
+ assert.equal(token, 'fake-token-value');
+ assert.match(capturedCommand, /^az account get-access-token /);
+ assert.match(capturedCommand, /--allow-no-subscriptions/);
+ assert.match(capturedCommand, /--resource "https:\/\/example\.crm\.dynamics\.com"/);
+ } finally {
+ if (originalChildProcess) require.cache[childProcessId] = originalChildProcess;
+ else delete require.cache[childProcessId];
+ delete require.cache[require.resolve(helpersPath)];
+ }
+});
diff --git a/plugins/power-pages/scripts/verify-dataverse-access.js b/plugins/power-pages/scripts/verify-dataverse-access.js
index c8f3ce3ba..35ddb323a 100644
--- a/plugins/power-pages/scripts/verify-dataverse-access.js
+++ b/plugins/power-pages/scripts/verify-dataverse-access.js
@@ -16,7 +16,7 @@ async function main() {
const token = getAuthToken(envUrl);
if (!token) {
- process.stderr.write('Failed to get Azure CLI token. Run `az login` first.\n');
+ process.stderr.write('Failed to get Azure CLI token. Run `az login --allow-no-subscriptions` first.\n');
process.exit(1);
}
@@ -31,7 +31,7 @@ async function main() {
}
if (res.statusCode === 401 || res.statusCode === 403) {
- process.stderr.write(`Authentication failed (${res.statusCode}). Token may be expired — run \`az login\` again.\n`);
+ process.stderr.write(`Authentication failed (${res.statusCode}). Token may be expired — run \`az login --allow-no-subscriptions\` again.\n`);
process.exit(1);
}
diff --git a/plugins/power-pages/skills/activate-site/SKILL.md b/plugins/power-pages/skills/activate-site/SKILL.md
index 3167ade3e..8649ba742 100644
--- a/plugins/power-pages/skills/activate-site/SKILL.md
+++ b/plugins/power-pages/skills/activate-site/SKILL.md
@@ -81,10 +81,10 @@ pac auth who
Verify the user is logged in to Azure CLI (the activation scripts acquire tokens internally):
```bash
-az account show
+az account show --allow-no-subscriptions
```
-**If `az` is not installed or not logged in**: Instruct the user to install Azure CLI and run `az login`.
+**If `az` is not installed or not logged in**: Instruct the user to install Azure CLI and run `az login --allow-no-subscriptions` (this form works whether or not the user has an Azure subscription — the activation flow only needs an AAD token).
#### 1.4 Check If Already Activated
@@ -222,7 +222,7 @@ Evaluate the JSON output:
|---|---|---|
| **`Succeeded`** | — | Provisioning complete. The result includes `siteUrl`. Proceed to Phase 5. |
| **`Failed`** | `400` + `SubdomainConflict` (or error message mentions subdomain) | Subdomain already taken. Loop back to Phase 2 action 2.2 for a new subdomain, then re-run the script. |
-| **`Failed`** | `401` | Token expired. Ask the user to run `az login` and retry. |
+| **`Failed`** | `401` | Token expired. Ask the user to run `az login --allow-no-subscriptions` and retry. |
| **`Failed`** | `403` | Insufficient permissions. Inform user they need the "Power Pages site creator" or "System Administrator" role. |
| **`Failed`** | `409` | Website already exists. Inform user and suggest using `/deploy-site` instead. |
| **`Failed`** | `429` or `5xx` | Throttling or server error. Wait 5 seconds and re-run the script once. |
diff --git a/plugins/power-pages/skills/activate-site/scripts/activate-site.js b/plugins/power-pages/skills/activate-site/scripts/activate-site.js
index bb3611489..cc4dae339 100644
--- a/plugins/power-pages/skills/activate-site/scripts/activate-site.js
+++ b/plugins/power-pages/skills/activate-site/scripts/activate-site.js
@@ -56,7 +56,7 @@ const siteUrl = `https://${args.subdomain}.${siteDomain}`;
let token = getAuthToken(ppApiBaseUrl);
if (!token) {
- output({ error: 'Azure CLI token not available. Run "az login" first.' });
+ output({ error: 'Azure CLI token not available. Run "az login --allow-no-subscriptions" first.' });
}
// --- Build request body ---
diff --git a/plugins/power-pages/skills/add-cloud-flow/SKILL.md b/plugins/power-pages/skills/add-cloud-flow/SKILL.md
index 1d47a01c5..845884288 100644
--- a/plugins/power-pages/skills/add-cloud-flow/SKILL.md
+++ b/plugins/power-pages/skills/add-cloud-flow/SKILL.md
@@ -33,7 +33,7 @@ For already-registered flows, the skill skips metadata and role creation and goe
> **Prerequisites:**
> - An existing Power Pages code site with `.powerpages-site` deployed
> - PAC CLI authenticated (`pac auth who` must succeed)
-> - Azure CLI authenticated (`az login`)
+> - Azure CLI authenticated (`az login --allow-no-subscriptions` works whether or not your account has an Azure subscription — Dataverse and Power Platform tokens are AAD-scoped)
**Initial request:** $ARGUMENTS
@@ -133,7 +133,7 @@ This calls the **Power Automate Flow RP API** with the filter `properties/defini
- **Already-registered flows**: Flows whose `id` matches a `processid` from Phase 1.5 — these already have metadata and roles but can be integrated into additional pages/components
**Handle errors**:
-- Exit code 1 with auth message → prompt the user to run `az login`
+- Exit code 1 with auth message → prompt the user to run `az login --allow-no-subscriptions`
- Zero flows from API (no flows with a PowerPages trigger exist at all) → tell the user that no Power Automate flows with a PowerPages trigger were found in this environment. Guide them to create a flow first:
> "No Power Automate cloud flows with a PowerPages trigger were found in this environment. To use this skill, you first need to create a flow in [Power Automate](https://make.powerautomate.com) with the **"When a Power Pages flow step is run"** trigger, then run this skill again to connect it to your site."
diff --git a/plugins/power-pages/skills/add-cloud-flow/scripts/list-cloud-flows.js b/plugins/power-pages/skills/add-cloud-flow/scripts/list-cloud-flows.js
index d10a8677f..5fbca95e7 100644
--- a/plugins/power-pages/skills/add-cloud-flow/scripts/list-cloud-flows.js
+++ b/plugins/power-pages/skills/add-cloud-flow/scripts/list-cloud-flows.js
@@ -60,7 +60,7 @@ const CLOUD_TO_FLOW_RESOURCE = {
if (!token) {
process.stderr.write(
'Error: Unable to obtain access token for the Power Automate service.\n' +
- 'Run `az login` and ensure your account has access to the environment.\n'
+ 'Run `az login --allow-no-subscriptions` and ensure your account has access to the environment.\n'
);
process.exit(1);
}
diff --git a/plugins/power-pages/skills/add-server-logic/assets/serverlogic-plan.html b/plugins/power-pages/skills/add-server-logic/assets/serverlogic-plan.html
index 916bd7f4c..4c700aada 100644
--- a/plugins/power-pages/skills/add-server-logic/assets/serverlogic-plan.html
+++ b/plugins/power-pages/skills/add-server-logic/assets/serverlogic-plan.html
@@ -216,7 +216,7 @@ function renderKvInstructions() {
<div class="kv-method">
<div class="kv-method-title"><span class="kv-method-icon">&#9002;</span> Option A &mdash; Azure CLI</div>
<ol class="kv-steps">
- <li>Open a terminal and ensure you are logged in: <code>az login</code></li>
+ <li>Open a terminal and ensure you are logged in: <code>az login --allow-no-subscriptions</code> (works without an Azure subscription if you have vault data-plane RBAC, e.g. <em>Key Vault Secrets Officer</em>)</li>
${secretRows}
</ol>
<div style="font-size:11px;color:var(--text-dim);margin-top:6px;">Each command prints a JSON object containing a <code>id</code> field &mdash; that is the Secret Identifier URI you will need.</div>
diff --git a/plugins/power-pages/skills/audit-permissions/scripts/query-table-lookups.js b/plugins/power-pages/skills/audit-permissions/scripts/query-table-lookups.js
index e015000d0..0f718479f 100644
--- a/plugins/power-pages/skills/audit-permissions/scripts/query-table-lookups.js
+++ b/plugins/power-pages/skills/audit-permissions/scripts/query-table-lookups.js
@@ -32,7 +32,7 @@ if (!envUrl || !table) {
(async () => {
const token = getAuthToken(envUrl);
if (!token) {
- process.stderr.write('Failed to get auth token. Run: az login\n');
+ process.stderr.write('Failed to get auth token. Run: az login --allow-no-subscriptions\n');
process.exit(1);
}
diff --git a/plugins/power-pages/skills/audit-permissions/scripts/query-table-relationships.js b/plugins/power-pages/skills/audit-permissions/scripts/query-table-relationships.js
index 12026acc0..a5bdf93f3 100644
--- a/plugins/power-pages/skills/audit-permissions/scripts/query-table-relationships.js
+++ b/plugins/power-pages/skills/audit-permissions/scripts/query-table-relationships.js
@@ -32,7 +32,7 @@ if (!envUrl || !table) {
(async () => {
const token = getAuthToken(envUrl);
if (!token) {
- process.stderr.write('Failed to get auth token. Run: az login\n');
+ process.stderr.write('Failed to get auth token. Run: az login --allow-no-subscriptions\n');
process.exit(1);
}