Skip to content

{AKS} az aks update: Fix --outbound-type validation for UDR and userAssignedNATGateway#9792

Open
FumingZhang wants to merge 1 commit intoAzure:mainfrom
FumingZhang:fix/aks-update-outbound-type-udr-validation
Open

{AKS} az aks update: Fix --outbound-type validation for UDR and userAssignedNATGateway#9792
FumingZhang wants to merge 1 commit intoAzure:mainfrom
FumingZhang:fix/aks-update-outbound-type-udr-validation

Conversation

@FumingZhang
Copy link
Copy Markdown
Member


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

Related command

Fixes Azure/azure-cli#33204

The CLI incorrectly required --vnet-subnet-id when updating outbound type to userDefinedRouting or userAssignedNATGateway. This parameter is not registered for 'aks update', creating an impossible state for users.

Changes:

  • In UPDATE mode, when vnet_subnet_id is empty, raise a clear InvalidArgumentValueError explaining that updating to UDR/ userAssignedNATGateway is only supported for BYO VNet clusters
  • In CREATE mode, preserve existing RequiredArgumentMissingError
  • For BYO VNet clusters, the subnet is already known from the agentpool, so validation passes and the update works correctly
  • Added 4 unit tests covering CREATE and UPDATE scenarios

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.

Copilot AI review requested due to automatic review settings April 17, 2026 07:15
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 17, 2026

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

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

Hi @FumingZhang,
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.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 17, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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 Markdown
Contributor

Hi @FumingZhang

Release Suggestions

Module: aks-preview

  • Update VERSION to 20.0.0b3 in src/aks-preview/setup.py

Notes

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

Fixes az aks update --outbound-type validation so updating to userDefinedRouting / userAssignedNATGateway no longer incorrectly requires --vnet-subnet-id (which isn’t registered for update), and instead emits a clear error for unsupported managed-VNet clusters.

Changes:

  • Adjust outbound type validation to raise InvalidArgumentValueError (UPDATE) vs RequiredArgumentMissingError (CREATE) when vnet_subnet_id is absent.
  • Add unit tests for update/create validation scenarios around UDR and user-assigned NAT gateway.
  • Document the behavior change in HISTORY.rst.

Reviewed changes

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

File Description
src/aks-preview/azext_aks_preview/managed_cluster_decorator.py Updates outbound-type validation logic to differentiate CREATE vs UPDATE behavior when subnet info is missing.
src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py Adds tests covering update/create paths for UDR and userAssignedNATGateway.
src/aks-preview/HISTORY.rst Adds changelog entry describing the improved update-time error behavior.

Comment thread src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
…Gateway

Fixes Azure/azure-cli#33204

The CLI incorrectly required --vnet-subnet-id when updating outbound type
to userDefinedRouting or userAssignedNATGateway. This parameter is not
registered for 'aks update', creating an impossible state for users.

Changes:
- In UPDATE mode, when vnet_subnet_id is empty, raise a clear
  InvalidArgumentValueError explaining that updating to UDR/
  userAssignedNATGateway is only supported for BYO VNet clusters
- In CREATE mode, preserve existing RequiredArgumentMissingError
- For BYO VNet clusters, the subnet is already known from the
  agentpool, so validation passes and the update works correctly
- Added 4 unit tests covering CREATE and UPDATE scenarios
@FumingZhang FumingZhang changed the title {AKS} aks update: Fix --outbound-type validation for UDR and userAssignedNATGateway {AKS} az aks update: Fix --outbound-type validation for UDR and userAssignedNATGateway Apr 17, 2026
@FumingZhang FumingZhang force-pushed the fix/aks-update-outbound-type-udr-validation branch from d53fbd0 to 12e9a42 Compare April 17, 2026 07:29
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.

Cannot use aks update --outbound-type userDefinedRouting

5 participants