[AI Manager] Add az aimanager modelsource commands - #10218
Conversation
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>
|
Hi gloriahxr, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
AI Manager |
There was a problem hiding this comment.
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 modelsourcecommands (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.
|
/azp run |
|
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>
|
/azp run |
|
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>
|
/azp run |
|
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>
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
🤖 PR Validation —⚠️ Review suggested
Add the new
az aimanager modelsourcecommand group, backed by theModelSourcesoperations of the vendored2026-05-02-previewSDK.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.az aimanager modelsource addPUT .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}az aimanager modelsource updatePUT .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}az aimanager modelsource showGET .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}az aimanager modelsource listGET .../aiManagers/{aiManagerName}/modelSourcesaz aimanager modelsource deleteDELETE .../aiManagers/{aiManagerName}/modelSources/{modelSourceName}Signature follows the existing nested groups:
-g,--aimanager-name,-n/--name,-s/--source-type.Behaviour notes:
--source-type/-sis required onaddand enumerated (HuggingFaceis the only value in this API version). It is immutable after creation, soupdatealways carries the existing value over on the create-or-replace PUT.--tokenis optional and is sent as an inline credential (properties.credential.inline.value) - only needed for gated or private sources.updateis a read-modify-PUT that preserves an omitted--description, matching the existingaz aimanager updateandaz aimanager namespace updatebehaviour.add/update/deletesupport--no-wait,deleterequires confirmation, and awaitcommand is included, consistent with the sibling groups.The vendored SDK already contained
ModelSourcesOperationsand theModelSourceProperties/CredentialValue/InlineCredentialmodels, so no SDK regeneration was needed. Extension version bumped1.2.0->1.2.1b1with a matchingHISTORY.rstentry.Testing
test_modelsource.pyunit tests covering payload construction (with and without a token), the already-exists / doesn't-exist guards onadd/update/delete, and thatupdatepreserves the immutable source type and the existing description.test_modelsource_scenario.pymocked scenario test exercisingadd/show/list/update/deleteend-to-end through the CLI parser, following the existingtest_modeldeployment_scenario.pypattern.azdev style(flake8) clean andpylint10.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 | deleteGeneral Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install azdevrequired)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.