Skip to content

Stop passing --allow-no-subscriptions to non-login az commands - #143

Merged
Priyanshu Agrawal (priyanshu92) merged 3 commits into
mainfrom
users/priyanshuag/fix-az-allow-no-subscriptions
May 7, 2026
Merged

Stop passing --allow-no-subscriptions to non-login az commands#143
Priyanshu Agrawal (priyanshu92) merged 3 commits into
mainfrom
users/priyanshuag/fix-az-allow-no-subscriptions

Conversation

@priyanshu92

@priyanshu92 Priyanshu Agrawal (priyanshu92) commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

The --allow-no-subscriptions flag is only valid on az login. Other az subcommands reject it as an unrecognized argument and exit non-zero, so the shared getAuthToken helper in scripts/lib/validation-helpers.js and the az account show login check in activate-site/SKILL.md were silently broken for every user — not just subscription-less accounts.

Verified locally:

$ az account get-access-token --resource "..." --allow-no-subscriptions ...
ERROR: unrecognized arguments: --allow-no-subscriptions

$ az account show --allow-no-subscriptions
ERROR: unrecognized arguments: --allow-no-subscriptions

Changes

  • scripts/lib/validation-helpers.js — drop the flag from the az account get-access-token invocation in getAuthToken so the shared auth helper actually works at runtime, and update the JSDoc to explain the constraint.
  • scripts/tests/validation-helpers.test.js — flip the assertion from matchdoesNotMatch. The previous test passed only because execSync was mocked; the real CLI invocation always failed.
  • skills/activate-site/SKILL.md — drop the flag from the az account show login check.
  • plugins/power-pages/AGENTS.md — replace the misleading convention with a clear rule:
    • --allow-no-subscriptions is only valid on az login.
    • When the user isn't logged in, suggest plain az login first; suggest az login --allow-no-subscriptions only as a fallback for accounts without any associated Azure subscription.

User-facing error messages that instruct az login --allow-no-subscriptions were left intact — that's correct usage.

Validation

$ node --test plugins/power-pages/scripts/tests/
# tests 141
# pass 141
# fail 0

The --allow-no-subscriptions flag is only valid on `az login`. Other az
subcommands reject it as an unrecognized argument and exit non-zero, so
`getAuthToken` and `az account show` were silently broken for every
user — even those with a subscription.

- scripts/lib/validation-helpers.js: drop the flag from the
  `az account get-access-token` invocation in `getAuthToken` so the
  shared auth helper actually works at runtime.
- scripts/tests/validation-helpers.test.js: flip the assertion to
  verify the flag is NOT passed (the previous test masked the bug
  because execSync was mocked).
- skills/activate-site/SKILL.md: drop the flag from the
  `az account show` login check.
- plugins/power-pages/AGENTS.md: replace the misleading guidance with
  a clear rule — only `az login` accepts --allow-no-subscriptions;
  subsequent `az account get-access-token` calls still mint
  AAD-scoped tokens for subscription-less accounts.

User-facing error messages that instruct `az login --allow-no-subscriptions`
remain unchanged — that usage is correct.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Suggest plain `az login` when the user isn't logged in; recommend
`az login --allow-no-subscriptions` only as a fallback for accounts
without any associated Azure subscription.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@priyanshu92
Priyanshu Agrawal (priyanshu92) requested a review from a team as a code owner May 7, 2026 06:13
Copilot AI review requested due to automatic review settings May 7, 2026 06:13
@priyanshu92 Priyanshu Agrawal (priyanshu92) changed the title Users/priyanshuag/fix az allow no subscriptions Stop passing --allow-no-subscriptions to non-login az commands May 7, 2026

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

This PR fixes incorrect Azure CLI usage in the Power Pages plugin by removing the unsupported --allow-no-subscriptions flag from non-az login commands, and aligning docs/tests with Azure CLI’s actual flag support.

Changes:

  • Update getAuthToken to stop passing --allow-no-subscriptions to az account get-access-token.
  • Update the corresponding unit test to assert the flag is not included.
  • Fix the activate-site skill docs to use az account show without the invalid flag.
  • Update AGENTS.md guidance to clarify the flag is only valid on az login.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
plugins/power-pages/skills/activate-site/SKILL.md Removes invalid Azure CLI flag from the login verification command.
plugins/power-pages/scripts/tests/validation-helpers.test.js Updates test to ensure getAuthToken does not include the unsupported flag.
plugins/power-pages/scripts/lib/validation-helpers.js Removes unsupported flag from az account get-access-token invocation and clarifies docstring behavior.
plugins/power-pages/AGENTS.md Updates contributor guidance to reflect correct Azure CLI flag applicability.

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

@priyanshu92
Priyanshu Agrawal (priyanshu92) merged commit 9758c21 into main May 7, 2026
6 checks passed
@priyanshu92
Priyanshu Agrawal (priyanshu92) deleted the users/priyanshuag/fix-az-allow-no-subscriptions branch May 7, 2026 06:32
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