Skip to content

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

Merged
Priyanshu Agrawal (priyanshu92) merged 1 commit into
mainfrom
users/priyanshuag/az-allow-no-subscriptions
Apr 29, 2026
Merged

[Pages] Allow az auth without an Azure subscription#132
Priyanshu Agrawal (priyanshu92) merged 1 commit into
mainfrom
users/priyanshuag/az-allow-no-subscriptions

Conversation

@priyanshu92

Copy link
Copy Markdown
Collaborator

Pass --allow-no-subscriptions on AAD-only Azure CLI calls so the plugin works for users whose Microsoft account has no Azure subscription (Dataverse and Power Platform tokens are AAD-scoped and don't require a subscription).

  • Update the shared getAuthToken helper in validation-helpers.js to pass the flag on az account get-access-token.
  • Refresh user-facing az login hint strings across scripts, SKILL.md, agent, and reference files to recommend az login --allow-no-subscriptions.
  • Clarify the list-azure-keyvaults.js error message — Key Vault is subscription-scoped, the flag does not apply there.
  • Document the convention in plugins/power-pages/AGENTS.md: apply the flag on AAD-only commands, never on subscription-scoped ones.
  • Add validation-helpers.test.js (stubs child_process.execSync via require.cache) to lock the flag in.

Pass `--allow-no-subscriptions` on AAD-only Azure CLI calls so the
plugin works for users whose Microsoft account has no Azure subscription
(Dataverse and Power Platform tokens are AAD-scoped and don't require a
subscription).

- Update the shared `getAuthToken` helper in `validation-helpers.js` to
  pass the flag on `az account get-access-token`.
- Refresh user-facing `az login` hint strings across scripts, SKILL.md,
  agent, and reference files to recommend `az login --allow-no-subscriptions`.
- Clarify the `list-azure-keyvaults.js` error message — Key Vault is
  subscription-scoped, the flag does not apply there.
- Document the convention in `plugins/power-pages/AGENTS.md`: apply the
  flag on AAD-only commands, never on subscription-scoped ones.
- Add `validation-helpers.test.js` (stubs `child_process.execSync` via
  require.cache) to lock the flag in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Power Pages plugin’s Azure CLI authentication flow so AAD-scoped token acquisition works even when the signed-in Microsoft account has no Azure subscriptions, and aligns user-facing guidance across scripts/docs.

Changes:

  • Add --allow-no-subscriptions to the shared getAuthToken() Azure CLI call (az account get-access-token) used by multiple scripts.
  • Refresh error/help text across scripts, skills, and agent/reference docs to recommend az login --allow-no-subscriptions for AAD-only operations.
  • Add a Node test intended to lock in the new getAuthToken() CLI flag behavior and document the new convention in AGENTS.md.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
plugins/power-pages/skills/audit-permissions/scripts/query-table-relationships.js Update auth failure hint to recommend az login --allow-no-subscriptions.
plugins/power-pages/skills/audit-permissions/scripts/query-table-lookups.js Update auth failure hint to recommend az login --allow-no-subscriptions.
plugins/power-pages/skills/add-server-logic/assets/serverlogic-plan.html Update Azure CLI login guidance shown in generated plan HTML.
plugins/power-pages/skills/add-cloud-flow/scripts/list-cloud-flows.js Update auth failure hint to recommend az login --allow-no-subscriptions.
plugins/power-pages/skills/add-cloud-flow/SKILL.md Update prerequisites + error-handling guidance for Azure CLI login.
plugins/power-pages/skills/activate-site/scripts/activate-site.js Update Azure CLI login hint string.
plugins/power-pages/skills/activate-site/SKILL.md Update Azure CLI verification/login guidance and 401 remediation text.
plugins/power-pages/scripts/verify-dataverse-access.js Update token acquisition + expired token remediation hints.
plugins/power-pages/scripts/tests/validation-helpers.test.js New test intended to ensure getAuthToken() passes --allow-no-subscriptions.
plugins/power-pages/scripts/list-custom-actions.js Update token acquisition failure hint.
plugins/power-pages/scripts/list-azure-keyvaults.js Clarify error message that Key Vault listing is subscription-scoped.
plugins/power-pages/scripts/lib/validation-helpers.js Add --allow-no-subscriptions to az account get-access-token command.
plugins/power-pages/scripts/dataverse-request.js Update token acquisition + refresh failure hints.
plugins/power-pages/scripts/create-environment-variable.js Update token acquisition failure hint.
plugins/power-pages/scripts/clear-site-cache.js Update token acquisition failure hint.
plugins/power-pages/references/dataverse-prerequisites.md Update docs to explain --allow-no-subscriptions and subscription-scoped exceptions.
plugins/power-pages/agents/webapi-settings-architect.md Update agent guidance for Azure CLI login hint.
plugins/power-pages/agents/table-permissions-architect.md Update agent guidance for Azure CLI login hint.
plugins/power-pages/agents/data-model-architect.md Update agent guidance for Azure CLI login hint.
plugins/power-pages/AGENTS.md Document convention on when to use --allow-no-subscriptions and to reuse getAuthToken().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/power-pages/scripts/tests/validation-helpers.test.js

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@priyanshu92
Priyanshu Agrawal (priyanshu92) merged commit 260127a into main Apr 29, 2026
10 checks passed
@priyanshu92
Priyanshu Agrawal (priyanshu92) deleted the users/priyanshuag/az-allow-no-subscriptions branch April 29, 2026 11:39
Priyanshu Agrawal (priyanshu92) added a commit that referenced this pull request Apr 29, 2026
…st (#133)

Follow-up to #132. The initial test stubbed `child_process` by swapping
the entry in `require.cache`, which relies on Node's caching of built-in
modules — implementation detail that may not hold across versions.

Switch to monkeypatching `childProcess.execSync` directly before
requiring `validation-helpers.js`, with cleanup via `t.after()`. This
exercises the helper through its real `require('child_process')` call
and is the idiomatic node:test approach.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants