Skip to content

[AKS] Skip SSH key configuration for Automatic SKU clusters - #33820

Open
mingqishao wants to merge 3 commits into
Azure:devfrom
mingqishao:aks-automatic-skip-ssh-key
Open

[AKS] Skip SSH key configuration for Automatic SKU clusters#33820
mingqishao wants to merge 3 commits into
Azure:devfrom
mingqishao:aks-automatic-skip-ssh-key

Conversation

@mingqishao

@mingqishao mingqishao commented Jul 31, 2026

Copy link
Copy Markdown

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Related command
az aks create ...

Description

Following the AKS Automatic quickstart, running az aks create --sku automatic fails with a server-side error:

(BadRequest) Managed cluster 'Automatic' SKU with managed system node pools enabled should not include SSH key configuration. Remove SSH key configuration and retry the request.

Automatic clusters use a fully managed system node pool that rejects any SSH key, so users were forced to manually add --no-ssh-key as a workaround. The CLI would also silently generate an SSH key pair on disk.

Fix: Make the CLI SSH-key-aware of the Automatic SKU:

Testing Guide

(1) --sku automatic --ssh-key-value ~/.ssh/id_rsa.pub (default) | ✅ Skip ssh key — no SSH error, proceeds to RG check
(2) --sku automatic --ssh-key-value "" (non-default) | ❌ Errors with message the Automatic don't support ssh key.
(3) --sku automatic (nothing) | ✅ don't generate ssh key
(4) --sku base | ✅ Proceeds — non-automatic unchanged

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


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

mingqishao and others added 3 commits July 31, 2026 13:31
Automatic SKU clusters use a fully managed system node pool that rejects
any SSH key configuration, forcing users to pass --no-ssh-key. Skip SSH
key reading/generation in validate_ssh_key and skip attaching the linux
profile in set_up_linux_profile when --sku automatic is used. If the user
explicitly passes --ssh-key-value or --generate-ssh-keys, raise a clear
MutuallyExclusiveArgumentError instead of the opaque server error.

Co-Authored-By: Claude <noreply@anthropic.com>
Change --ssh-key-value default from the hardcoded ~/.ssh/id_rsa.pub path to
None so the validator can distinguish an explicitly-provided key from the
default. For --sku automatic, any --ssh-key-value (including the default
path) or --generate-ssh-keys now raises MutuallyExclusiveArgumentError
instead of being silently ignored. The non-Automatic path is unchanged: a
None value still falls back to the default key location.

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 31, 2026 21:45
@mingqishao
mingqishao requested review from a team and FumingZhang as code owners July 31, 2026 21:45
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jul 31, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

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

@a0x1ab

a0x1ab commented Jul 31, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

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

This PR updates AKS cluster creation validation and model construction so --sku automatic no longer triggers SSH key generation/reading or attaches a Linux profile, preventing the server-side BadRequest caused by including SSH key configuration for Automatic SKU clusters.

Changes:

  • Skip SSH key validation/generation in validate_ssh_key when --sku automatic is used (and error if an explicit SSH key / generate flag is provided).
  • Avoid attaching linux_profile for Automatic SKU clusters during managed cluster construction.
  • Add unit tests covering the new Automatic SKU behavior in validators and the managed cluster decorator.

Reviewed changes

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

File Description
src/azure-cli/azure/cli/command_modules/acs/_validators.py Skips SSH key read/generation for Automatic SKU; errors on explicit SSH key configuration for that SKU.
src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py Skips linux profile attachment for Automatic SKU to avoid sending SSH config to the service.
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_validators.py Adds validator tests for Automatic SKU SSH key skipping and conflict scenarios.
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py Adds decorator test ensuring linux profile is omitted for Automatic SKU.

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

Comment on lines +6652 to +6653
if self.context.get_sku_name() == CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC:
return mc
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 customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants