[AKS] Skip SSH key configuration for Automatic SKU clusters - #10166
Conversation
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. Fixes AB#39034381 Co-Authored-By: Claude <noreply@anthropic.com>
For --sku automatic, skip SSH key generation entirely; if the user explicitly passes --generate-ssh-keys or --ssh-key-value, raise a MutuallyExclusiveArgumentError instead of silently ignoring it. Co-Authored-By: Claude <noreply@anthropic.com>
--enable-hosted-system already requires --sku automatic, so the SKU check alone covers all cases. Drop the redundant get_enable_hosted_system() clause. Co-Authored-By: Claude <noreply@anthropic.com>
The --ssh-key-value default is expanded by file_type (os.path.expanduser) before validation, so comparing against the unexpanded "~/.ssh/id_rsa.pub" string mis-detected the default as an explicit key. Expand both sides before comparing. Co-Authored-By: Claude <noreply@anthropic.com>
|
Hi Mitch Shao (@mingqishao), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR updates the aks-preview extension to make az aks create --sku automatic not require (or attempt) SSH key generation/validation, aligning with Automatic clusters’ fully managed system node pool behavior that rejects SSH configuration.
Changes:
- Skip SSH key validation/generation in
validate_ssh_keywhen--sku automaticis used, while erroring if users explicitly try to configure SSH keys for Automatic. - Skip attaching a
linux_profile(and thus SSH configuration) during managed cluster creation for the Automatic SKU. - Add/extend unit tests covering the new validator and decorator behaviors, and document the change in
HISTORY.rst.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/aks-preview/HISTORY.rst | Documents the pending change to SSH key behavior for Automatic clusters. |
| src/aks-preview/azext_aks_preview/_validators.py | Adds an Automatic SKU early-exit to bypass SSH key read/generation and block explicit SSH configuration. |
| src/aks-preview/azext_aks_preview/managed_cluster_decorator.py | Skips Linux profile (SSH config) setup for Automatic SKU clusters. |
| src/aks-preview/azext_aks_preview/tests/latest/test_validators.py | Adds unit tests validating validate_ssh_key behavior for Automatic SKU (including case-insensitivity and conflicts). |
| src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py | Adds a unit test ensuring Linux profile setup is skipped for Automatic SKU. |
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>
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This reverts commit 6ed2297.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
fixed |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
🤖 PR Validation — ️✔️ All clear
Summary
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:
(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
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
https://github.com/Azure/azure-cli/blob/dev/doc/command_guidelines.md
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install azdevrequired)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.jsonautomatically.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.