Skip to content

[AI Manager] Add namespace access key commands - #10219

Merged
Ethan Yang (necusjz) merged 3 commits into
Azure:mainfrom
gloriahxr:gloriahxr-aimanager-namespace-accesskeys
Aug 17, 2026
Merged

[AI Manager] Add namespace access key commands#10219
Ethan Yang (necusjz) merged 3 commits into
Azure:mainfrom
gloriahxr:gloriahxr-aimanager-namespace-accesskeys

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
⚠️ 1010 - ParaPropUpdate aimanager namespace add cmd aimanager namespace add update parameter ai_manager_name: updated property options from ['--manager', '-m'] to ['--aimanager-name', '--manager', '-m']
⚠️ 1010 - ParaPropUpdate aimanager namespace delete cmd aimanager namespace delete update parameter ai_manager_name: updated property options from ['--manager', '-m'] to ['--aimanager-name', '--manager', '-m']
⚠️ 1010 - ParaPropUpdate aimanager namespace get-credentials cmd aimanager namespace get-credentials update parameter ai_manager_name: updated property options from ['--manager', '-m'] to ['--aimanager-name', '--manager', '-m']
⚠️ 1010 - ParaPropUpdate aimanager namespace list cmd aimanager namespace list update parameter ai_manager_name: updated property options from ['--manager', '-m'] to ['--aimanager-name', '--manager', '-m']
⚠️ 1001 - CmdAdd aimanager namespace list-accesskeys cmd aimanager namespace list-accesskeys added
⚠️ 1001 - CmdAdd aimanager namespace rotate-accesskeys cmd aimanager namespace rotate-accesskeys added
⚠️ 1010 - ParaPropUpdate aimanager namespace show cmd aimanager namespace show update parameter ai_manager_name: updated property options from ['--manager', '-m'] to ['--aimanager-name', '--manager', '-m']
⚠️ 1010 - ParaPropUpdate aimanager namespace update cmd aimanager namespace update update parameter ai_manager_name: updated property options from ['--manager', '-m'] to ['--aimanager-name', '--manager', '-m']
⚠️ 1010 - ParaPropUpdate aimanager namespace wait cmd aimanager namespace wait update parameter ai_manager_name: updated property options from ['--manager', '-m'] to ['--aimanager-name', '--manager', '-m']

Add the two remaining namespace-scoped access key commands to the az aimanager namespace group, backed by the AIManagerNamespaces operations of the vendored 2026-05-02-preview SDK.

Command Endpoint
az aimanager namespace list-accesskeys POST .../aiManagers/{aiManagerName}/namespaces/{namespaceName}/listAccessKeys
az aimanager namespace rotate-accesskeys POST .../aiManagers/{aiManagerName}/namespaces/{namespaceName}/rotateKeys

Both return NamespaceAccessInfo: the OpenAI-compatible inference gateway endpoint plus the primary and secondary API keys.

az aimanager namespace list-accesskeys -g myrg --aimanager-name my-ai-manager -n team-alpha
az aimanager namespace rotate-accesskeys -g myrg --aimanager-name my-ai-manager -n team-alpha

Behaviour notes:

  • rotate-accesskeys generates a new key as primaryKey and demotes the previous primaryKey to secondaryKey, so clients can roll over without downtime. Because this invalidates whatever was previously in secondaryKey, the command requires confirmation (--yes to skip), consistent with the other destructive commands in this extension.
  • The underlying SDK method for rotation is rotate_keys, mapped to the rotate-accesskeys command name so it reads consistently alongside list-accesskeys.
  • Both commands accept --aks-custom-headers, like the rest of the group.

This PR also adds --aimanager-name as an alias of --manager/-m on the az aimanager namespace group. The nested az aimanager namespace modeldeployment group already uses --aimanager-name, so the tree is currently inconsistent depending on how deep you are. The existing --manager/-m options 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-credentials already exists on main and already posts to .../namespaces/{namespaceName}/listCredential, so it is unchanged here.

Extension version bumped 1.2.0 -> 1.2.1b1 with a matching HISTORY.rst entry.

Testing

  • New test_namespace_accesskeys.py unit tests asserting both commands call the right SDK operation with the right arguments and that --aks-custom-headers is forwarded.
  • New test_namespace_accesskeys_scenario.py mocked scenario test exercising both commands end-to-end through the CLI parser, including that rotation demotes the previous primary key and that -m still works.
  • 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 namespace list-accesskeys | rotate-accesskeys

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 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>
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 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-accesskeys and az aimanager namespace rotate-accesskeys commands (with confirmation for rotation).
  • Add --aimanager-name as an alias for --manager/-m on az aimanager namespace for consistency with nested groups.
  • Bump extension version to 1.2.1b1 and 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.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
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>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

Comment thread src/aimanager/setup.py
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>
gloriahxr added a commit to gloriahxr/azure-cli-extensions that referenced this pull request Aug 17, 2026
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>
gloriahxr added a commit to gloriahxr/azure-cli-extensions that referenced this pull request Aug 17, 2026
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).

Ethan Yang (necusjz) pushed a commit that referenced this pull request Aug 17, 2026
* 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>
Ethan Yang (necusjz) pushed a commit that referenced this pull request Aug 17, 2026
* [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>
@necusjz
Ethan Yang (necusjz) merged commit fcfaeab into Azure:main Aug 17, 2026
24 checks passed
@azclibot

Copy link
Copy Markdown
Collaborator

[Release] Update index.json for extension [ aimanager-1.2.1b1 ] : https://dev.azure.com/msazure/One/_build/results?buildId=176882219&view=results

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.

7 participants