Skip to content

[KeyVault] Fix error message to reference the actual vault name option - #34220

Open
Yeming Liu (isra-fel) wants to merge 4 commits into
Azure:devfrom
isra-fel:copilot/fix-az-keyvault-purge-help-output
Open

Yeming Liu (isra-fel) wants to merge 4 commits into
Azure:devfrom
isra-fel:copilot/fix-az-keyvault-purge-help-output

Conversation

@isra-fel

@isra-fel Yeming Liu (isra-fel) commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Related command
az keyvault purge, az keyvault recover, az keyvault show-deleted, az keyvault show, az keyvault delete, az keyvault create

Description
These commands expose the vault name as --name/-n, but the validators hard-coded --vault-name in their errors, pointing users at a non-existent option:

$ az keyvault purge
ERROR: Please specify --vault-name or --hsm-name.   # before
ERROR: Please specify --name/-n or --hsm-name.      # after
  • _validators.py: added _get_vault_name_options(ns), which reads the options_list actually registered for the vault_name argument on the current command and falls back to --vault-name when it can't be resolved.
  • validate_vault_name_and_hsm_name and validate_deleted_vault_or_hsm_name build their "please specify" / "mutually exclusive" messages from it, so commands registering --vault-name (e.g. az keyvault private-link-resource) keep the existing wording.
  • Added tests/latest/test_validators.py covering the --name/-n, --vault-name, fallback, and success paths.

Testing Guide

az keyvault purge           # Please specify --name/-n or --hsm-name.
az keyvault show-deleted    # Please specify --name/-n or --hsm-name.
az keyvault private-link-resource list -g rg   # Please specify --vault-name or --hsm-name.

History Notes

[Key Vault] az keyvault purge/recover/show-deleted: Fix error message to reference --name/-n instead of the non-existent --vault-name


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI and others added 4 commits September 16, 2026 07:41
@isra-fel
Yeming Liu (isra-fel) requested a review from a team as a code owner October 13, 2026 05:32
Copilot AI balanced review requested due to automatic review settings October 13, 2026 05:32
@isra-fel Yeming Liu (isra-fel) changed the title [keyvault] Fix parameter names in error messages [KeyVault] Fix error message to reference the actual vault name option Oct 13, 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.

🟢 Approval recommended

The focused implementation matches command registration behavior and includes appropriate tests.

0 open findings

What changed in this PR

Fixes Key Vault validation errors to display the command’s actual vault-name options.

Changes:

  • Dynamically resolves registered vault-name aliases with a safe fallback.
  • Adds validator coverage for aliases, fallback, exclusivity, and success paths.
File Description
_validators.py Builds accurate vault/HSM validation messages.
tests/​latest/​test_validators.py Tests updated validator behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@a0x1ab Aditya Pujara (a0x1ab) added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Oct 14, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-identity-squad.

@x-engineering-agent x-engineering-agent Bot 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.

Yeming Liu (@isra-fel)

Review

All 55 upstream checks passed on c32240f60b59. The change is scoped to validator error wording; no request/response fields or service output changed, and no recording update is indicated by this diff.

Scenario coverage to verify

The assertions in src/azure-cli/azure/cli/command_modules/keyvault/tests/latest/test_validators.py exercise registered-option variants, fallback, mutual exclusion and single-name success. They construct their own command metadata, however, rather than invoke the command that reproduces #17923. Passing these tests does not establish that az keyvault purge without arguments emits Please specify --name/-n or --hsm-name. through the real parser and validator chain.

Add a command-level regression to that test file using the repository's command-loading/invocation harness, and verify the exact error before human approval. Cover recover/show-deleted as the description claims, plus a --vault-name command such as private-link-resource list to confirm its wording remains unchanged. Rerun the focused keyvault validator tests and the command-invocation regression; this is deterministic validation and need not contact Azure.

Test validation

  • Agent live test: Not run; this is a review-only PR. Check author-provided test evidence and upstream CI separately.
  • Regression coverage: For keyvault: 1 focused test file(s) changed. Scenario coverage is unverified; review the issue's required conditions, test setup, and assertions before approval. No linked issue was found in the PR timeline; inspect the source issue and its required scenario manually.

The description references #17923, which was inspected separately: its required scenario is the no-argument purge error, not an ARM operation. Author-provided evidence consists of the changed unit assertions and the testing guide; neither is an Agent live run.

Risk assessment

0/100 · Low · High confidence

The Low rating reflects the detected change scope with no elevated security, reliability, customer, operational, dependency, sovereign-cloud, generated-output, or cross-component signal.

  • Change scope: 2 changed files, 80 changed lines (+77 / -3), including 1 production file.
  • Affected components: keyvault
  • Risk drivers: No elevated risk signal was detected.
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: No additional owning-squad review signal was detected.

Posted by x-engineering-agent (Reviewer)

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Oct 14, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-identity-squad.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-identity-squad Auto-Assign Auto assign by bot KeyVault az keyvault Request X Engineering Agent Ask the agent to triage this issue or review this PR X Engineering Agent Reviewed Agent reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az keyvault purge without arguments gives invalid help output

5 participants