Skip to content

[AKS] az aks install-cli: Add optional native Azure skills installation - #34101

Open
Tom Gamble (gambtho) wants to merge 25 commits into
Azure:devfrom
gambtho:feature/aks-azure-skills
Open

Tom Gamble (gambtho) wants to merge 25 commits into
Azure:devfrom
gambtho:feature/aks-azure-skills

Conversation

@gambtho

@gambtho Tom Gamble (gambtho) commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests
⚠️ None ️✔️ 130/130
⚠️AzureCLI-BreakingChangeTest
⚠️acs
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd aks install-cli cmd aks install-cli added parameter install_azure_skills
⚠️ 1006 - ParaAdd aks install-cli cmd aks install-cli added parameter skills_agents

Related command

az aks install-cli

Description

Offer native, opt-in installation of Microsoft Azure skills after the existing kubectl and kubelogin installation succeeds.

  • In an interactive, non-sudo session, offer installation with a default of No. Detect Claude Code, Codex, GitHub Copilot, and Pi; preselect detected agents and allow numbered selection/deselection.
  • Show user-level destinations and scope before final confirmation, including under --only-show-errors. Use native Knack prompts and typed Azure CLI errors.
  • Add --install-azure-skills true|false and --skills-agents. Explicit installation requires targets and bypasses prompts; omitted noninteractive execution and explicit false preserve binary-only behavior.
  • Retrieve the latest stable microsoft/azure-skills release by resolved commit, install complete skill trees/resources and license notices, and report provenance. Install no MCP configuration, hooks, or agent applications; add no runtime dependencies.
  • Reuse --gh-token for trusted GitHub metadata requests only. Bound transport/download/extraction, reject unsafe archive paths and destination indirection, and stage before publication.
  • First-install-only, not an updater: skip identical existing directories; preserve/report differing content. New skills can be added, but retries across releases can leave mixed versions. Do not overwrite user modifications or automatically remove skills.
  • Preserve completed binary installations on optional failure. Explicit skills failures return nonzero with partial-result and recovery guidance.

Codex uses the shared ~/.agents/skills directory, so deselecting another agent does not prevent that agent from discovering shared skills. Selection controls installation destinations, not agent enablement.

Testing Guide

After running the CLI from this branch:

# Existing command: offers skills only in an eligible interactive session.
az aks install-cli

# Explicit binary-only behavior.
az aks install-cli --install-azure-skills false

# Unattended opt-in for selected agents.
az aks install-cli --install-azure-skills true --skills-agents claude-code codex github-copilot pi

Run unprivileged when testing skills installation. If default binary destinations need elevated access, use user-writable --install-location and --kubelogin-install-location paths, including the binary filenames. A skills acceptance installs into the selected user-level directories; automated verification instead used temporary destinations.

Verification performed on Linux/Python 3.14 with worktree source overlays:

  • test_azure_skills, test_custom, and test_validators: 402 tests run, 400 passed, 2 known skips.
  • Ruff E/F checks using repository ignores, targeted pycodestyle E128 checks on all six changed Python files, and git diff --check: passed.
  • Live v1.2.49 (abaf74ac8f62fbe9f83d7ccb2bd991dca929a4da) smoke after the conformance changes: 28 installations, then 28 identical no-ops; all 926 original payload files byte-matched; notices retained; temporary state removed.
  • Real-console regression coverage exercises native selection/consent under both quiet-mode configurations. Earlier implementation validation also exercised seven pseudo-terminal scenarios.
  • Polish and independent task/whole-branch reviews completed. CodeRabbit CLI reviewed the full committed diff twice; its minor continuation-indentation findings were corrected and verified. The follow-up review included the repository command/error guidelines.

The two skips are native Windows junction coverage and an existing kubelogin custom-source test. Existing ResourceWarnings/datetime deprecations remain unchanged. Native Windows/macOS, Python 3.10 runtime, full azdev ACS/style/linter gates, and actual agent/MCP workflows have not been exercised locally; CI/platform review remains necessary.

History Notes

[AKS] az aks install-cli: Add optional native Azure skills installation for coding agents


Copilot AI lite review requested due to automatic review settings September 19, 2026 02:06
@azure-pipelines

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

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.

Copilot review overview

🔵 Needs a closer look

The changes require final human review because they are too complex or risky for automated approval.

Review effort: Lite
Findings: None

What changed in this PR

Adds opt-in native Azure skills installation to az aks install-cli, preserving existing binary behavior while supporting agent detection, safe downloads, staging, and non-overwriting publication.

Changes:

  • Adds interactive and explicit skills-installation modes with agent selection.
  • Implements bounded GitHub release retrieval, archive validation, and secure publication.
  • Adds extensive tests, help text, and design/implementation documentation.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​acs/​tests/​latest/​test_custom.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​acs/​tests/​latest/​test_azure_skills.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​acs/​custom.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​acs/​_params.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​acs/​_help.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​acs/​_azure_skills.py Updated as part of this pull request.
docs/​superpowers/​specs/​2026-09-18-aks-azure-skills-design.md Updated as part of this pull request.
docs/​superpowers/​plans/​2026-09-18-aks-azure-skills.md Updated as part of this pull request.
docs/​superpowers/​implementation/​2026-09-19-aks-azure-skills.md Updated as part of this pull request.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@FumingZhang FumingZhang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found three issues to address before merge: an unhandled home-directory resolution failure, a parser test that is already failing in both full-test jobs, and the blocking style violations.

Comment thread src/azure-cli/azure/cli/command_modules/acs/_azure_skills.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_azure_skills.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acs/_azure_skills.py Outdated

@FumingZhang FumingZhang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consider adding a scenario test case to help validate the change

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

def discover_agents() -> list[AgentTarget]:
try:
home = Path.home()
except RuntimeError as error:

@FumingZhang FumingZhang Sep 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Path.home() can raise RuntimeError when the home directory cannot be resolved, such as in a minimal container running under a numeric UID with no HOME or passwd entry. Before this catch was added, that failure escaped as a raw traceback after binary installation. Handling it as FileOperationError preserves optional-mode binary success and gives explicit mode a normal CLI error.

def test_invalid_agent_is_rejected_by_parser(self):
result, handler = self.invoke(['--install-azure-skills', '--skills-agents', 'unknown'])
self.assertEqual(result, 2)
handler.assert_not_called()

@FumingZhang FumingZhang Sep 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] The previous assertion against a late sys.stderr patch failed deterministically in both Python 3.12 and 3.14 full-test jobs because the CLI logging handlers were not guaranteed to write there. Keeping this test focused on exit code 2 and confirming that the command handler was not called removes the merge-blocking false failure.

reasons.append(failure)
failure = 'Azure skills installation is incomplete. ' + '; '.join(reasons)
if failure:
message = (f'{failure} kubectl and kubelogin remain installed. {source} ' +

@FumingZhang FumingZhang Sep 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] This expression previously triggered the required style gate (W503), alongside several pylint violations in the new module, and therefore blocked the PR from merging. The refactoring now satisfies the style checks; the priority reflects the merge-blocking gate rather than a runtime defect.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants