[AI Manager] Add namespace access key commands - #10219
Conversation
Add two commands to the 'az aimanager namespace' group, backed by the
AIManagerNamespaces operations of the vendored 2026-05-02-preview SDK:
* az aimanager namespace list-accesskeys -> POST .../namespaces/{name}/listAccessKeys
* az aimanager namespace rotate-accesskeys -> POST .../namespaces/{name}/rotateKeys
Both return the NamespaceAccessInfo payload with the OpenAI-compatible gateway
endpoint and the primary/secondary API keys. 'rotate-accesskeys' requires
confirmation because it invalidates the previous secondary key.
Also accept '--aimanager-name' as an alias of '--manager'/'-m' on the namespace
group, matching the option name already used by
'az aimanager namespace modeldeployment'. The existing options keep working.
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 the remaining namespace-scoped access-key commands to the az aimanager namespace command group, aligning the CLI surface with the vendored 2026-05-02-preview SDK’s AIManagerNamespaces operations while improving argument consistency across the command tree.
Changes:
- Add
az aimanager namespace list-accesskeysandaz aimanager namespace rotate-accesskeyscommands (with confirmation for rotation). - Add
--aimanager-nameas an alias for--manager/-monaz aimanager namespacefor consistency with nested groups. - Bump extension version to
1.2.1b1and add release notes + new unit/scenario tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/aimanager/setup.py | Bumps extension package version to 1.2.1b1. |
| src/aimanager/HISTORY.rst | Adds release notes for 1.2.1b1. |
| src/aimanager/azext_aimanager/custom.py | Implements custom handlers that call list_access_keys / rotate_keys and forward --aks-custom-headers. |
| src/aimanager/azext_aimanager/commands.py | Registers the new CLI commands and adds confirmation for rotation. |
| src/aimanager/azext_aimanager/_params.py | Adds --aimanager-name alias and wires --aks-custom-headers for the new commands. |
| src/aimanager/azext_aimanager/_help.py | Adds help entries for the new commands. |
| src/aimanager/azext_aimanager/azext_metadata.json | Bumps extension metadata version to 1.2.1b1. |
| src/aimanager/azext_aimanager/tests/latest/test_namespace_accesskeys.py | Adds unit tests verifying SDK method invocation + header forwarding. |
| src/aimanager/azext_aimanager/tests/latest/test_namespace_accesskeys_scenario.py | Adds a mocked scenario test for CLI parsing and command execution. |
💡 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). |
Add a CLI invocation that passes --aks-custom-headers and assert the parsed headers reach the SDK call, so the public option name and its wiring are pinned end-to-end rather than only at the function level. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Per review feedback, this PR carries the single version bump and the combined changelog for the three related aimanager PRs, so they release once instead of three times. The model and modelsource PRs now carry code only. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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>
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). |
* Add az aimanager model commands
Add the 'az aimanager model' command group backed by the AIModels operations
of the vendored 2026-05-02-preview SDK:
* az aimanager model show -l <location> -n <model>
* az aimanager model list -l <location>
* az aimanager model calculate-cost -l <location> -n <model>
'calculate-cost' posts to
/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/aiModels/{modelName}/calculateCost
and returns the ranked GPU SKU pricing plans. Table transformers are provided
for 'list' and 'calculate-cost'.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Align aimanager preview release version
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Drop version bump so the release is batched in one PR
Per review feedback, keep the version and changelog changes in a single PR
(#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>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* [AI Manager] Add az aimanager modelsource commands
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>
* Tighten modelsource scenario test and reword HISTORY entry
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>
* Drop version bump so the release is batched in one PR
Per review feedback, keep the version and changelog changes in a single PR
(#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>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
[Release] Update index.json for extension [ aimanager-1.2.1b1 ] : https://dev.azure.com/msazure/One/_build/results?buildId=176882219&view=results |
🤖 PR Validation —⚠️ Review suggested
Add the two remaining namespace-scoped access key commands to the
az aimanager namespacegroup, backed by theAIManagerNamespacesoperations of the vendored2026-05-02-previewSDK.az aimanager namespace list-accesskeysPOST .../aiManagers/{aiManagerName}/namespaces/{namespaceName}/listAccessKeysaz aimanager namespace rotate-accesskeysPOST .../aiManagers/{aiManagerName}/namespaces/{namespaceName}/rotateKeysBoth return
NamespaceAccessInfo: the OpenAI-compatible inference gateway endpoint plus the primary and secondary API keys.Behaviour notes:
rotate-accesskeysgenerates a new key asprimaryKeyand demotes the previousprimaryKeytosecondaryKey, so clients can roll over without downtime. Because this invalidates whatever was previously insecondaryKey, the command requires confirmation (--yesto skip), consistent with the other destructive commands in this extension.rotate_keys, mapped to therotate-accesskeyscommand name so it reads consistently alongsidelist-accesskeys.--aks-custom-headers, like the rest of the group.This PR also adds
--aimanager-nameas an alias of--manager/-mon theaz aimanager namespacegroup. The nestedaz aimanager namespace modeldeploymentgroup already uses--aimanager-name, so the tree is currently inconsistent depending on how deep you are. The existing--manager/-moptions keep working unchanged, so this is not a breaking change - it just lets the same option name be used at both levels. Happy to drop this part if you would rather keep the groups as they are.az aimanager namespace get-credentialsalready exists onmainand already posts to.../namespaces/{namespaceName}/listCredential, so it is unchanged here.Extension version bumped
1.2.0->1.2.1b1with a matchingHISTORY.rstentry.Testing
test_namespace_accesskeys.pyunit tests asserting both commands call the right SDK operation with the right arguments and that--aks-custom-headersis forwarded.test_namespace_accesskeys_scenario.pymocked scenario test exercising both commands end-to-end through the CLI parser, including that rotation demotes the previous primary key and that-mstill works.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 namespace list-accesskeys | rotate-accesskeysGeneral 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.