Skip to content

Conversation

@ShantingLiu
Copy link
Contributor

@ShantingLiu ShantingLiu commented Nov 5, 2025

  • Generated AAZ commands from 2025-05-02-preview API
  • Added custom classes to support -g/-n argument pattern (matching official CLI)
  • Implemented Pod Security Standards (PSS) feature with --pss-level flag
  • Supports three PSS levels: Privileged, Baseline, Restricted
  • Added comprehensive test scenarios
  • Commands: create, show, update, delete, list, wait

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

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • 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.

- Generated AAZ commands from 2025-05-02-preview API
- Added custom classes to support -g/-n argument pattern (matching official CLI)
- Implemented Pod Security Standards (PSS) feature with --pss-level flag
- Supports three PSS levels: Privileged, Baseline, Restricted
- Added comprehensive test scenarios
- Commands: create, show, update, delete, list, wait
Copilot AI review requested due to automatic review settings November 5, 2025 22:47
@azure-client-tools-bot-prd
Copy link

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

⚠️Azure CLI Extensions Breaking Change Test
⚠️aks-preview
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd aks safeguards sub group aks safeguards added

@azure-client-tools-bot-prd
Copy link

Hi @ShantingLiu,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@ShantingLiu ShantingLiu changed the title Add AKS Safeguards commands with Pod Security Standards support Add AKS Safeguards commands with Pod Security Standards support into Preview CLI Nov 5, 2025
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 5, 2025

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

@github-actions
Copy link

github-actions bot commented Nov 5, 2025

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

github-actions bot commented Nov 5, 2025

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

github-actions bot commented Nov 5, 2025

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 adds support for AKS Safeguards with Pod Security Standards to the Azure CLI aks-preview extension. The implementation includes CLI commands for managing deployment safeguards (create, show, update, delete, list, wait) with support for both full resource ID and resource group/name argument patterns.

  • Adds new aks safeguards command group with CRUD operations
  • Implements custom command classes to support both -c/--managed-cluster and -g/-n argument patterns
  • Includes comprehensive test coverage for basic safeguards, PSS integration, and argument validation
  • Updates minimum CLI core version to 2.75.0

Reviewed Changes

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

Show a summary per file
File Description
test_aks_safeguards.py New test suite covering basic safeguards, PSS features, and argument validation scenarios
commands.py Registers custom safeguards command implementations
azext_metadata.json Updates minimum CLI core version from 2.73.0 to 2.75.0
aks_safeguards_custom.py Custom command classes implementing argument validation and resource ID construction
aaz/latest/aks/safeguards/*.py Auto-generated command implementations for safeguards CRUD operations
__init__.py files Initializes aaz module and loads command tables

Comment on lines 52 to 59
"az configure --defaults group=<name>. You may provide either 'managed_cluster' "
"or both 'resource_group' and 'name', but not both.",
required=False,
)
_args_schema.cluster_name = AAZStrArg(
options=["--name", "-n"],
help="The name of the Managed Cluster. You may provide either 'managed_cluster' "
"or both 'resource_group' and 'name', but not both.",
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

The help text refers to 'resource_group' and 'name' parameters, but should refer to the actual argument names that users will see: '--resource-group' (-g) and '--name' (-n). This would be clearer as 'You may provide either --managed-cluster or both --resource-group and --name, but not both.'

Suggested change
"az configure --defaults group=<name>. You may provide either 'managed_cluster' "
"or both 'resource_group' and 'name', but not both.",
required=False,
)
_args_schema.cluster_name = AAZStrArg(
options=["--name", "-n"],
help="The name of the Managed Cluster. You may provide either 'managed_cluster' "
"or both 'resource_group' and 'name', but not both.",
"az configure --defaults group=<name>. You may provide either --managed-cluster "
"or both --resource-group (-g) and --name (-n), but not both.",
required=False,
)
_args_schema.cluster_name = AAZStrArg(
options=["--name", "-n"],
help="The name of the Managed Cluster. You may provide either --managed-cluster "
"or both --resource-group (-g) and --name (-n), but not both.",

Copilot uses AI. Check for mistakes.
@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

- Wrap <name> placeholder in backticks to fix HTML tag linter error
- Add customer-facing description to HISTORY.rst under Pending section
- Add test_aks_deployment_safeguards_basic.yaml recording
- Add test_aks_deployment_safeguards_with_pss.yaml recording
- Add test_aks_deployment_safeguards_argument_validation.yaml recording
- Fix test name prefixes to avoid randomness validation errors
- Sanitized subscription IDs with nil UUID (00000000-0000-0000-0000-000000000000)
- Revert azext_metadata.json minCliCoreVersion to 2.73.0
The az aks safeguards commands are already available in the official CLI.
The aks-preview extension overrides them through custom commands in commands.py.
No need to explicitly load AAZ commands here.
1. Fix typo: 'workround' -> 'workaround' in test file
2. Fix resource ID construction: add missing '/subscriptions/' prefix
3. Fix help text: use CLI argument names (--managed-cluster, --resource-group, --name) instead of parameter names
@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).


@AllowLargeResponse(size_kb=9999)
@ResourceGroupPreparer(name_prefix='cli-', random_name_length=8, location="westus2")
def test_aks_deployment_safeguards_basic(self):
Copy link
Member

Choose a reason for hiding this comment

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

Queued live test to validate the change.

Copy link
Member

@FumingZhang FumingZhang Nov 6, 2025

Choose a reason for hiding this comment

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

Re-queued live test, test passed!

@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@github-actions github-actions bot added the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Nov 7, 2025
@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Azure Azure deleted a comment from github-actions bot Nov 7, 2025
@github-actions github-actions bot removed the release-version-block Updates do not qualify release version rules. NOTE: please do not edit it manually. label Nov 7, 2025
@yanzhudd yanzhudd merged commit c09f542 into Azure:main Nov 7, 2025
31 of 34 checks passed
@yanzhudd
Copy link
Contributor

yanzhudd commented Nov 7, 2025

please submit a PR for the changes to aaz repo as well

@azclibot
Copy link
Collaborator

azclibot commented Nov 7, 2025

[Release] Update index.json for extension [ aks-preview-19.0.0b14 ] : https://dev.azure.com/msazure/One/_build/results?buildId=142991653&view=results

@ShantingLiu
Copy link
Contributor Author

ShantingLiu commented Nov 7, 2025

please submit a PR for the changes to aaz repo as well

Azure/aaz#897 Does this look correct? First time, thanks. @yanzhudd

Changes include:

  • API resource files (XML/JSON) for the 2025-05-02-preview version with podSecurityStandardsLevel property
  • Documentation updates to all command files (_create, _update, _delete, _show, _list) with PSS examples using --pss-level parameter"

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.

7 participants