Skip to content

Conversation

@ShantingLiu
Copy link
Contributor

@ShantingLiu ShantingLiu commented Nov 17, 2025

Changes Made

  • Change help text examples to use first-person imperative verbs
  • 'Creates' -> 'Create', 'Deletes' -> 'Delete', 'Gets' -> 'Get'
  • Add pre-existence check to az aks safeguards create to prevent duplicate resource creation
  • Block duplicate creates with helpful error message guiding users to use update or delete commands
  • Fix duplicate 19.0.0b16 headers in HISTORY.rst
  • Update version to 19.0.0b17
  • Add changelog entries

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

Related command

az aks safeguards create, az aks safeguards delete, az aks safeguards show

Description

This PR addresses two improvements to the safeguards commands:

  1. Help text verb tense fix: Updated examples in _create.py, _delete.py, and _show.py to use first-person imperative verbs per Azure CLI guidelines (e.g., "Create" instead of "Creates").

  2. Pre-existence validation: Added a check in az aks safeguards create to prevent duplicate resource creation. The command now:

    • Checks if a Deployment Safeguards resource already exists before attempting to create
    • Returns a clear error message directing users to az aks safeguards update or az aks safeguards delete
    • Supports both -g/-n and --managed-cluster URI syntax

Testing

  • Tested create when resource doesn't exist (succeeds)
  • Tested create when resource exists (blocks with helpful error)
  • Tested with both -g/-n and --managed-cluster URI syntax
  • Verified error message guides users to correct commands

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Unable to run: azdev requires a full Azure CLI development environment with both azure-cli and azure-cli-extensions repos configured via azdev setup. This PR contains help text changes in AAZ-generated files and validation logic. The CI pipeline will validate this automatically.
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Addresses feedback from PR #897

- Change help text examples to use first-person imperative verbs
- 'Creates' -> 'Create', 'Deletes' -> 'Delete', 'Gets' -> 'Get'
- Update version to 19.0.0b17
- Add changelog entry
Copilot AI review requested due to automatic review settings November 17, 2025 17:58
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Nov 17, 2025

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 17, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link

CodeGen Tools Feedback Collection

Thank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey

@github-actions
Copy link

Copy link
Contributor

Copilot AI left a comment

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 verb tense in safeguards help text to align with Azure CLI documentation guidelines by changing from third-person present tense (e.g., "Creates", "Deletes", "Gets") to first-person imperative verbs (e.g., "Create", "Delete", "Get"). The version is also bumped to 19.0.0b17 with a corresponding changelog entry.

  • Updated help text examples in _show.py, _delete.py, and _create.py to use imperative verb forms
  • Incremented version from 19.0.0b16 to 19.0.0b17 in setup.py
  • Added changelog entry documenting the help text fix

Reviewed Changes

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

Show a summary per file
File Description
src/aks-preview/setup.py Version bump from 19.0.0b16 to 19.0.0b17
src/aks-preview/azext_aks_preview/aaz/latest/aks/safeguards/_show.py Changed "Gets" to "Get" in example descriptions
src/aks-preview/azext_aks_preview/aaz/latest/aks/safeguards/_delete.py Changed "Deletes" to "Delete" in example descriptions
src/aks-preview/azext_aks_preview/aaz/latest/aks/safeguards/_create.py Changed "Creates" to "Create" in example descriptions
src/aks-preview/HISTORY.rst Added changelog entry for version 19.0.0b17

…Y entry

- Add validation in _execute_operations() to check if Deployment Safeguards already exists before creating
- Block duplicate creates with helpful error message guiding users to update or delete
- Supports both -g/-n and --managed-cluster URI syntax
- Fix duplicate 19.0.0b16 headers in HISTORY.rst
- Update HISTORY.rst with new pre-existence check feature
@ShantingLiu ShantingLiu changed the title [Safeguards] Fix verb tense in safeguards help text [Safeguards] Fix verb tense in help text and add pre-existence check Nov 17, 2025
@FumingZhang
Copy link
Member

please fix failed CI checks

Jenny Liu added 4 commits November 18, 2025 16:32
…rror import

- Changed self.ctx.cmd.cli_ctx to self.ctx.cli_ctx in aks_safeguards_custom.py
- Added CLIError import from azure.cli.core.azclierror
- Updated test recordings for all three safeguards tests
- All tests passing: basic, argument_validation, with_pss
The duplicate resource check logic was in the AAZ-generated _create.py file,
which would be overwritten when AAZ tools regenerate the file. Moved all the
duplicate checking logic to the custom class pre_operations() method in
aks_safeguards_custom.py where it belongs.

This ensures the logic will persist through AAZ regeneration.
All three safeguards tests have been re-recorded in live mode to ensure
recordings reflect the corrected code structure with duplicate checking
logic in the custom class.
Generated new recording files by running all three tests together in live mode:
- test_aks_deployment_safeguards_basic.yaml (212KB)
- test_aks_deployment_safeguards_argument_validation.yaml (164KB)
- test_aks_deployment_safeguards_with_pss.yaml (240KB)

All recordings reflect the corrected code with duplicate checking in custom class.
Linting fixes:
- Remove duplicate import of is_valid_resource_id
- Split long line (167 chars) into multiple lines to meet 120 char limit
- Extract API version to variable for better readability

Regenerated all three test recordings with the linting fixes applied.
All tests passing (38 minutes total runtime).
Copy link
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

lgtm

Queued live test to validate the change, test passed!

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

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants