Skip to content

[AI Manager] Add az aimanager modelsource commands - #10218

Merged
Ethan Yang (necusjz) merged 4 commits into
Azure:mainfrom
gloriahxr:gloriahxr-aimanager-modelsource
Aug 17, 2026
Merged

[AI Manager] Add az aimanager modelsource commands#10218
Ethan Yang (necusjz) merged 4 commits into
Azure:mainfrom
gloriahxr:gloriahxr-aimanager-modelsource

Conversation

@gloriahxr

@gloriahxr gloriahxr commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes
⚠️ None
⚠️Azure CLI Extensions Breaking Change Test
⚠️aimanager
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd aimanager modelsource sub group aimanager modelsource added

Add the new az aimanager modelsource command group, backed by the ModelSources operations of the vendored 2026-05-02-preview SDK.

A model source tells the platform where to pull model artifacts from and, for gated or private sources, which credential to authenticate with. It is the resource referenced by az aimanager namespace modeldeployment add --model-source-resource-id, which previously had no way to be created from the CLI.

Command Endpoint
az aimanager modelsource add PUT .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}
az aimanager modelsource update PUT .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}
az aimanager modelsource show GET .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}
az aimanager modelsource list GET .../aiManagers/{aiManagerName}/modelSources
az aimanager modelsource delete DELETE .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}

Signature follows the existing nested groups: -g, --aimanager-name, -n/--name, -s/--source-type.

az aimanager modelsource add -g myrg --aimanager-name my-ai-manager -n hf -s HuggingFace
az aimanager modelsource add -g myrg --aimanager-name my-ai-manager -n hf -s HuggingFace --token hf_xxx --description "Gated models"

Behaviour notes:

  • --source-type/-s is required on add and enumerated (HuggingFace is the only value in this API version). It is immutable after creation, so update always carries the existing value over on the create-or-replace PUT.
  • --token is optional and is sent as an inline credential (properties.credential.inline.value) - only needed for gated or private sources.
  • update is a read-modify-PUT that preserves an omitted --description, matching the existing az aimanager update and az aimanager namespace update behaviour.
  • add/update/delete support --no-wait, delete requires confirmation, and a wait command is included, consistent with the sibling groups.

The vendored SDK already contained ModelSourcesOperations and the ModelSourceProperties/CredentialValue/InlineCredential models, so no SDK regeneration was needed. Extension version bumped 1.2.0 -> 1.2.1b1 with a matching HISTORY.rst entry.

Testing

  • New test_modelsource.py unit tests covering payload construction (with and without a token), the already-exists / doesn't-exist guards on add/update/delete, and that update preserves the immutable source type and the existing description.
  • New test_modelsource_scenario.py mocked scenario test exercising add/show/list/update/delete end-to-end through the CLI parser, following the existing test_modeldeployment_scenario.py pattern.
  • azdev style (flake8) clean and pylint 10.00/10 against the repo configs.

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

Related command

az aimanager modelsource add | update | list | show | delete

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install azdev required)
  • My extension version conforms to the Extension version schema

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.json automatically.
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.

Add the 'az aimanager modelsource' command group, backed by the ModelSources
operations of the vendored 2026-05-02-preview SDK, against
.../aiManagers/{aiManagerName}/modelSources[/{modelSourceName}]:

* az aimanager modelsource add|update|show|list|delete (+ wait)

'add' requires --source-type/-s (currently HuggingFace) and optionally takes
--description and --token, where --token is sent as an inline credential for
gated or private sources. 'update' is a read-modify-PUT that preserves the
immutable source type and any omitted description.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 14, 2026 09:23
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi gloriahxr,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in pyproject.toml (or setup.py, if the extension has not migrated yet) as well.

@azure-pipelines

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

@yonzhan

Copy link
Copy Markdown
Collaborator

AI Manager

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

Adds a new az aimanager modelsource command group to manage AI Manager model sources (create/update/show/list/delete/wait), wiring CLI commands/parameters/help to the existing vendored 2026-05-02-preview ModelSources SDK operations so users can create the model source resource referenced by model deployments.

Changes:

  • Introduces aimanager modelsource commands (add/update/show/list/delete/wait) and client factory wiring.
  • Adds argument definitions, validators, constants, and help text for model source parameters (--source-type, --token, etc.).
  • Adds unit + scenario tests and bumps extension version/history.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/aimanager/setup.py Bumps extension version to 1.2.1b1.
src/aimanager/HISTORY.rst Adds release notes entry for the new command group.
src/aimanager/azext_aimanager/tests/latest/test_modelsource.py Adds unit tests for model source payload construction and CRUD guards.
src/aimanager/azext_aimanager/tests/latest/test_modelsource_scenario.py Adds mocked end-to-end scenario test for model source commands.
src/aimanager/azext_aimanager/custom.py Implements model source CRUD custom handlers and payload construction.
src/aimanager/azext_aimanager/constants.py Adds supported MODEL_SOURCE_TYPES enum values.
src/aimanager/azext_aimanager/commands.py Registers aimanager modelsource commands and wait behavior.
src/aimanager/azext_aimanager/azext_metadata.json Updates extension version metadata.
src/aimanager/azext_aimanager/_validators.py Adds validate_model_source_name.
src/aimanager/azext_aimanager/_params.py Adds CLI arguments for the modelsource group.
src/aimanager/azext_aimanager/_help.py Adds help text and examples for modelsource commands.
src/aimanager/azext_aimanager/_client_factory.py Adds cf_model_sources client factory.

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

Comment thread src/aimanager/azext_aimanager/custom.py
Comment thread src/aimanager/azext_aimanager/tests/latest/test_modelsource.py
Comment thread src/aimanager/HISTORY.rst Outdated
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

Match the get side effect list to the four reads the scenario actually makes
and assert the call count, so an unexpected extra GET fails the test. Also
reword the HISTORY entry to read as a complete phrase.

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 2 pipeline(s).

Per review feedback, keep the version and changelog changes in a single PR
(Azure#10219) so the three related aimanager PRs produce
one release instead of three. This PR now carries code only.

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 2 pipeline(s).

Resolve the additive conflicts left by the az aimanager model commands (Azure#10217)
landing on main. Both command groups add a client factory, an SDK command type,
a validator and a constants block at the same anchor points, so every conflict
is resolved by keeping both sides.

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 2 pipeline(s).

@necusjz
Ethan Yang (necusjz) merged commit 3fe69b0 into Azure:main Aug 17, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants