Skip to content

[AKS] az aks create/update: Add support for Advanced Network Policies for ACNS#32265

Merged
yanzhudd merged 1 commit intoAzure:devfrom
nddq:nddq/acns-l7-cli
Oct 27, 2025
Merged

[AKS] az aks create/update: Add support for Advanced Network Policies for ACNS#32265
yanzhudd merged 1 commit intoAzure:devfrom
nddq:nddq/acns-l7-cli

Conversation

@nddq
Copy link
Copy Markdown
Member

@nddq nddq commented Oct 15, 2025

feat(acns) add advanced network policies options for az create and update commands

Related command
az aks create --enable-acns --acns-advanced-networkpolicies <None|L7|FQDN>
az aks update --enable-acns --acns-advanced-networkpolicies <None|L7|FQDN>

Description
Creates commands for specify advanced network policies (None, FQDN, L7) during AKS cluster creation and update.

Testing Guide
Note: These commands will only be applicable for Cilium clusters

  • --enable-acns --acns-advanced-networkpolicies None - Enable the entire ACNS feature suite without advanced network policies.
  • --enable-acns --acns-advanced-networkpolicies FQDN - Enable the entire ACNS feature suite with FQDN policy only. This is the default option if only --enable-acns is passed.
  • --enable-acns --acns-advanced-networkpolicies L7 - Enable the entire ACNS feature suite with L7 policies. L7 policies includes FQDN policy in addition to other policies for L7 protocols such as HTTP or Kafka.

History Notes

[AKS] az aks create/update: Add --acns-advanced-networkpolicies parameter to support enabling advanced networking policies (None, L7 or FQDN). This is part of the ACNS Security feature suite


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

@nddq nddq requested a review from zhoxing-ms as a code owner October 15, 2025 18:32
Copilot AI review requested due to automatic review settings October 15, 2025 18:32
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Oct 15, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

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

azure-client-tools-bot-prd bot commented Oct 15, 2025

⚠️AzureCLI-BreakingChangeTest
⚠️acs
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd aks create cmd aks create added parameter acns_advanced_networkpolicies
⚠️ 1006 - ParaAdd aks update cmd aks update added parameter acns_advanced_networkpolicies

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Oct 15, 2025

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

@github-actions
Copy link
Copy Markdown

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>

Copy link
Copy Markdown
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 Advanced Network Policies (ACNS) in Azure Kubernetes Service (AKS) clusters by introducing the --acns-advanced-networkpolicies parameter for both az aks create and az aks update commands. The parameter accepts three values: None, FQDN, and L7, allowing users to configure different levels of network policy enforcement when enabling the ACNS feature suite.

  • Added parameter validation and mutual exclusivity checks with existing ACNS disable flags
  • Implemented network profile configuration logic for advanced network policies in both create and update flows
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
_consts.py Added constants for advanced network policies values and fixed code formatting
_params.py Added the new parameter definition with enum validation for both create and update commands
_help.py Added documentation for the new parameter and standardized quote usage
custom.py Added the parameter to function signatures for create and update commands
linter_exclusions.yml Added exception for the long parameter name
managed_cluster_decorator.py Implemented core logic for parameter validation and network profile configuration
test_managed_cluster_decorator.py Added comprehensive test coverage for the new functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/acs/_help.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acs/_help.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py Outdated
@nddq nddq force-pushed the nddq/acns-l7-cli branch from 3ce97da to 357cac2 Compare October 15, 2025 18:55
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown
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.

Please fix failed CI checks

name_prefix="clitest",
location="eastus2euap",
)
def test_aks_create_with_advanced_networkpolicies(
Copy link
Copy Markdown
Member

@FumingZhang FumingZhang Oct 16, 2025

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, test passed!

@nddq nddq force-pushed the nddq/acns-l7-cli branch from 357cac2 to 2b86898 Compare October 17, 2025 03:38
@nddq nddq requested a review from FumingZhang October 17, 2025 04:24
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@nddq nddq force-pushed the nddq/acns-l7-cli branch from 2b86898 to aa5fd0f Compare October 21, 2025 14:17
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

Please commit new recording files to pass CI

https://dev.azure.com/azclitools/public/public%20Team/_build/results?buildId=277676&view=logs&j=950e443e-fa90-5f50-4303-cd9168964025&t=e8e1e5d0-e808-59fd-7db9-daddfd146787&l=4120

       raise AssertionError(ex)

E AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_with_advanced_networkpolicies.yaml') in your current record mode ('once').
E No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001?api-version=2025-08-01>) was found.
E Found 2 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001?api-version=2025-07-02-preview>)..)
E Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E Matchers failed :
E _custom_request_query_matcher - assertion failure :
E None
E
E 2 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001?api-version=2025-07-02-preview>)..)
E Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E Matchers failed :
E _custom_request_query_matcher - assertion failure :
E None

@nddq nddq force-pushed the nddq/acns-l7-cli branch from aa5fd0f to 3ed50e5 Compare October 22, 2025 19:36
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

…date commands

Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
@nddq nddq force-pushed the nddq/acns-l7-cli branch from 3ed50e5 to 8d622af Compare October 23, 2025 02:29
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

@microsoft-github-policy-service rerun

@yanzhudd yanzhudd merged commit a3bbf27 into Azure:dev Oct 27, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS az aks/acs/openshift Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants