Skip to content

[AKS] az aks nodepool rollback: Add rollback commands#33509

Open
InduSridhar wants to merge 1 commit into
Azure:devfrom
InduSridhar:indu/aks-nodepool-rollback-ga
Open

[AKS] az aks nodepool rollback: Add rollback commands#33509
InduSridhar wants to merge 1 commit into
Azure:devfrom
InduSridhar:indu/aks-nodepool-rollback-ga

Conversation

@InduSridhar

@InduSridhar InduSridhar commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Related command

az aks nodepool get-rollback-versions
az aks nodepool rollback

Description

This PR adds GA Azure CLI support for AKS agentpool rollback, matching the aks-preview extension implementation for the 2026-04 GA API surface.

Changes:

  • Add az aks nodepool get-rollback-versions to return recently_used_versions from the agent pool upgrade profile.
  • Add az aks nodepool rollback to roll back an agent pool to the most recently used Kubernetes and node image version.
  • Add table formatting, command help, parameters, and release history entry.
  • Use stable CLI helpers for custom headers and SDK v41+ ETag handling.

Testing Guide

Added unit coverage in azure.cli.command_modules.acs.tests.latest.test_custom for:

  • Returning rollback versions from the upgrade profile.
  • Selecting the most recent rollback version by timestamp.
  • Updating the agent pool Kubernetes and node image versions before begin_create_or_update.
  • Passing custom headers and ETag kwargs through the stable CLI helpers.
  • Raising CLIError when no rollback history is available.

PR validation status:

  • Azure.azure-cli Full Test succeeded.
  • azdev-linter succeeded.
  • azdev-style succeeded.
  • Azure.azure-cli Breaking Change Test succeeded.
  • Local git diff --check succeeded.

Python tests were not run locally because Python is not installed in this environment.

History Notes

[AKS] az aks nodepool get-rollback-versions, az aks nodepool rollback: Add commands to get rollback versions and roll back an agent pool to the most recently used configuration.


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

Copilot AI review requested due to automatic review settings June 8, 2026 20:21
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 8, 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
️✔️cdn
️✔️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 Jun 8, 2026

Copy link
Copy Markdown
⚠️AzureCLI-BreakingChangeTest
⚠️acs
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd aks nodepool get-rollback-versions cmd aks nodepool get-rollback-versions added
⚠️ 1001 - CmdAdd aks nodepool rollback cmd aks nodepool rollback added

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds new AKS nodepool rollback functionality to expose rollback history and roll back a node pool to its most recently used version.

Changes:

  • Introduces az aks nodepool get-rollback-versions to list rollback candidates.
  • Introduces az aks nodepool rollback to roll back to the most recent (N-1) version.
  • Adds help text, table output formatting, and release notes entry.

Reviewed changes

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

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/acs/custom.py Implements rollback versions retrieval and rollback operation logic
src/azure-cli/azure/cli/command_modules/acs/commands.py Wires new commands into the command table and table formatter
src/azure-cli/azure/cli/command_modules/acs/_params.py Adds parameter context for the new rollback command
src/azure-cli/azure/cli/command_modules/acs/_help.py Documents new commands and parameters
src/azure-cli/azure/cli/command_modules/acs/_format.py Adds table transformer for rollback versions output
src/azure-cli/HISTORY.rst Mentions new commands in release history

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

Comment on lines +3157 to +3161
sorted_versions = sorted(
upgrade_profile.recently_used_versions,
key=lambda version: version.timestamp if version.timestamp else datetime.datetime.min,
reverse=True,
)
Comment on lines +3139 to +3146
if upgrade_channel_enabled or node_os_channel_enabled:
logger.warning(
"Auto-upgrade is enabled on cluster '%s' (upgradeChannel=%s, nodeOSUpgradeChannel=%s). "
"Rollback will not succeed until auto-upgrade is disabled. Please disable auto-upgrade to roll back the node pool.",
cluster_name,
upgrade_channel or "none",
node_os_upgrade_channel or "Unmanaged",
)
Comment on lines +44 to +52
def _format_rollback_version(result):
parsed = compile_jmes("""{
kubernetesVersion: orchestratorVersion,
nodeImageVersion: nodeImageVersion,
timestamp: timestamp
}""")
return parsed.search(result, Options(dict_cls=OrderedDict))

return [_format_rollback_version(r) for r in results]
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@InduSridhar InduSridhar force-pushed the indu/aks-nodepool-rollback-ga branch from 4165ddc to 137c671 Compare June 8, 2026 21:02
@InduSridhar InduSridhar changed the title Add AKS nodepool rollback commands [AKS] az aks nodepool rollback: Add rollback commands Jun 8, 2026
@yonzhan

yonzhan commented Jun 8, 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.

4 participants