Skip to content

[AKS] az aks update: Fix --outbound-type validation for UDR and userAssignedNATGateway#33694

Open
FumingZhang wants to merge 2 commits into
Azure:devfrom
FumingZhang:fix/aks-update-outbound-type-udr-validation-2
Open

[AKS] az aks update: Fix --outbound-type validation for UDR and userAssignedNATGateway#33694
FumingZhang wants to merge 2 commits into
Azure:devfrom
FumingZhang:fix/aks-update-outbound-type-udr-validation-2

Conversation

@FumingZhang

Copy link
Copy Markdown
Member

Related command
az aks update --outbound-type

Description
Fixes #33204.

az aks update --outbound-type userDefinedRouting/userAssignedNATGateway incorrectly required --vnet-subnet-id, which is not registered for aks update, creating an impossible state for users.

Changes in AKSManagedClusterContext._get_outbound_type:

  • In UPDATE mode, when no subnet is available, raise a clear InvalidArgumentValueError explaining that migrating to userDefinedRouting/userAssignedNATGateway is only supported for BYO (custom) VNet clusters, instead of asking for the non-existent --vnet-subnet-id argument.
  • In CREATE mode, preserve the existing RequiredArgumentMissingError behavior.
  • For BYO VNet clusters, the subnet is already known from the agentpool, so validation passes and the update works correctly without re-specifying the subnet.
  • Added unit tests covering CREATE and UPDATE scenarios for both UDR and userAssignedNATGateway.

This mirrors Azure/azure-cli-extensions#9792 for the built-in acs module.

Testing Guide

azdev test acs --tests AKSManagedClusterContextTestCase.test_get_outbound_type
  • BYO VNet cluster: az aks update -g <rg> -n <cluster> --outbound-type userDefinedRouting succeeds without --vnet-subnet-id.
  • Managed VNet cluster: the same command now fails with a clear, actionable error message.

History Notes
[AKS] az aks update: Fix --outbound-type validation for userDefinedRouting and userAssignedNATGateway so BYO VNet clusters no longer require --vnet-subnet-id and managed VNet clusters get a clear error message

@FumingZhang FumingZhang requested a review from a team as a code owner July 2, 2026 01:03
Copilot AI review requested due to automatic review settings July 2, 2026 01:03
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jul 2, 2026

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

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jul 2, 2026

Copy link
Copy Markdown
️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

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.

Pull request overview

Fixes az aks update --outbound-type validation so UPDATE mode no longer requests the non-existent --vnet-subnet-id argument when migrating to userDefinedRouting/userAssignedNATGateway. Instead, it raises a clear InvalidArgumentValueError explaining that migration is only supported for clusters using a custom (BYO) VNet; CREATE mode keeps the existing “missing required arg” behavior.

Changes:

  • Add UPDATE-mode-specific validation for userDefinedRouting and userAssignedNATGateway when no subnet is available, producing an actionable error for managed VNet clusters.
  • Add/extend unit tests covering UPDATE-mode success/failure scenarios for outbound type validation.

Reviewed changes

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

File Description
src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py Adjusts outbound-type validation to emit a clear UPDATE-mode error for managed VNet clusters instead of referencing --vnet-subnet-id.
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py Adds tests for UPDATE-mode outbound-type validation paths (BYO subnet present vs absent).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yonzhan

yonzhan commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

AKS

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

Labels

act-observability-squad AKS az aks/acs/openshift 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

4 participants