Skip to content

[Cognitive Services] az cognitiveservices account create: Add BYO AKS agent hosting support - #34303

Merged
mansoor sarfraz (msarfraz) merged 20 commits into
Azure:devfrom
jessiezhu-m:jessiezhu/byo-aks-agent-hosting
Nov 5, 2026
Merged

mansoor sarfraz (msarfraz) merged 20 commits into
Azure:devfrom
jessiezhu-m:jessiezhu/byo-aks-agent-hosting

Conversation

@jessiezhu-m

@jessiezhu-m jessie zhu (jessiezhu-m) commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests Suppressions
⚠️ None ️✔️ 130/130 ⚠️ 2 added
⚠️AzureCLI-BreakingChangeTest
⚠️cognitiveservices
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd cognitiveservices account create cmd cognitiveservices account create added parameter agent_hosting_cluster
⚠️ 1006 - ParaAdd cognitiveservices account create cmd cognitiveservices account create added parameter agent_hosting_management_identity
⚠️ 1006 - ParaAdd cognitiveservices account create cmd cognitiveservices account create added parameter agent_hosting_storage
⚠️ 1006 - ParaAdd cognitiveservices account create cmd cognitiveservices account create added parameter agent_hosting_workload_identity

This PR adds warning or check suppressions. Fix the underlying warning where possible and justify each remaining suppression in a code comment or the PR description.

2 added suppressions
File Line Kind Code
src/azure-cli/azure/cli/command_modules/cognitiveservices/_agent_hosting_preflight.py 66 pylint class PreflightResult: # pylint: disable=too-many-instance-attributes
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py 175 pylint def create( # pylint: disable=too-many-locals

Related command

az cognitiveservices account create

Description

Add preview support for customer-owned AKS agent hosting when creating an Azure AI Services account.

  • Add flattened --agent-hosting-* arguments for the AKS cluster, Storage account, hosting-management identity, and workload identity.
  • Run a read-only preflight before Azure writes to validate the account and custom domain, Azure CNI Overlay AKS configuration and node pools, supplied Storage and identities, tenant alignment, operator permissions, and required grants.
  • Create or reuse omitted dependencies and configure the required role assignments before submitting the account request.
  • Treat an existing account as an idempotent retry only when its location and hosting configuration match; reject missing or conflicting hosting before dependency queries and skip dependency preparation for matching retries.
  • Preserve the existing payload and behavior when BYO AKS arguments are not supplied.
  • Do not expose agent subnet or account networkInjections support in this change.
  • Add focused unit and scenario coverage for payload construction, argument validation, preflight behavior, dependency preparation, permission checks, and failure isolation.

Testing Guide

  • azdev test test_agent_hosting test_agent_hosting_preparation --discover equivalent targeted pytest run: 86 passed, 139 subtests passed.
  • azdev style cognitiveservices: passed.
  • azdev linter cognitiveservices: passed with no violations.
  • az cognitiveservices account create --help: verified the four --agent-hosting-* arguments are present and --agent-subnet is absent.

Focused tests are included in:

  • src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent_hosting.py
  • src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_agent_hosting_preparation.py

History Notes

The history note will be generated from the PR title.

Manual Tests
image
image


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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8ad0ac21-86e7-465c-a642-adf09ac26cb9
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8ad0ac21-86e7-465c-a642-adf09ac26cb9
…on rules

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8ad0ac21-86e7-465c-a642-adf09ac26cb9
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 775adbaa-4b8a-46b0-8f77-d6e24e8b87f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 775adbaa-4b8a-46b0-8f77-d6e24e8b87f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 775adbaa-4b8a-46b0-8f77-d6e24e8b87f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 775adbaa-4b8a-46b0-8f77-d6e24e8b87f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 775adbaa-4b8a-46b0-8f77-d6e24e8b87f8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5c6dbffd-c51b-4f82-8506-5e50e85e5a52
Expose subnet as a non-preview account create option and build network injection independently. Update planning, help, and regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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 Oct 29, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution jessie zhu (@jessiezhu-m)! We will review the pull request and get back to you soon.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@jessiezhu-m
jessie zhu (jessiezhu-m) marked this pull request as ready for review October 30, 2026 11:59
Copilot AI balanced review requested due to automatic review settings October 30, 2026 12:00

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.

🟡 Changes recommended

Preflight incorrectly rejects valid cluster- and account-scoped permissions and fails to catch existing-account location mismatches before creating dependencies.

3 open issues
What changed in this PR

Adds preview support for customer-owned AKS agent hosting to az cognitiveservices account create, extending the existing account-creation flow with prerequisite validation and dependency preparation.

Changes:

  • Adds four agent-hosting arguments, identity aliases, and a usage example.
  • Validates prerequisites before creating or reusing dependencies and configuring role assignments.
  • Adds payload, argument, preflight, provisioning, and failure-isolation tests while preserving non-hosting behavior.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​tests/​latest/​test_agent_hosting.py Tests arguments, hosting payloads, and existing behavior.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​tests/​latest/​test_agent_hosting_preparation.py Tests validation, permissions, provisioning, and failure isolation.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​custom.py Integrates dependency preparation and hosting configuration into account creation.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_params.py Registers preview hosting arguments and identity aliases.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_help.py Adds an AKS hosting example.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_client_factory.py Provides management clients for hosting prerequisites.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_agent_hosting.py Creates or reuses dependencies and configures role assignments.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_agent_hosting_preflight.py Implements read-only resource and permission validation.

Review effort: Balanced

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@jessiezhu-m

jessie zhu (jessiezhu-m) commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Yong Zhang (@yonzhan) Can you or your team member help review this pr? We target to catch up the upcoming release.

@yonzhan

Copy link
Copy Markdown
Collaborator

Adding mansoor sarfraz (@msarfraz) to help with

@msarfraz mansoor sarfraz (msarfraz) added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Nov 4, 2026
@x-engineering-agent

Copy link
Copy Markdown
Contributor

X Engineering Agent Pull request review: In progress

In progress — X Engineering Agent is reviewing this PR at 5191caf. This comment will be updated with the results.

X Engineering Agent · React with +1 or -1 to train the agent

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.

Looks good overall.
Non-blocking: (1) the node-pool preflight lists all compute SKUs for the region, which can take a while, so consider an info log or a help note about the wait. (2) Please add a short comment explaining the two new pylint disables (too-many-instance-attributes, too-many-locals). (3) The hard-coded Kata image baseline 202608.14.0 and Kubernetes 1.31 will need updating as the service evolves, so a link to the source of truth in a code comment would help. (4) A recorded or live scenario would be a good follow-up before GA.

@msarfraz
mansoor sarfraz (msarfraz) merged commit bec9b20 into Azure:dev Nov 5, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-experience-enablement-squad act-observability-squad AKS az aks/acs/openshift Auto-Assign Auto assign by bot Cognitive Services az cognitiveservices customer-reported Issues that are reported by GitHub users external to the Azure organization. Request X Engineering Agent Ask the agent to triage this issue or review this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants