Skip to content

[Cognitive Services] az cognitiveservices account adapter-deployment: Add new command group (preview) - #34112

Open
saanikaguptamicrosoft wants to merge 7 commits into
Azure:devfrom
saanikaguptamicrosoft:saanika/adapter-deployment-cli
Open

saanikaguptamicrosoft wants to merge 7 commits into
Azure:devfrom
saanikaguptamicrosoft:saanika/adapter-deployment-cli

Conversation

@saanikaguptamicrosoft

@saanikaguptamicrosoft saanikaguptamicrosoft commented Sep 22, 2026

Copy link
Copy Markdown
Member

Mirrors the az cognitiveservices account managed-compute-deployment pattern from PR #33338. Adds four commands (create/show/list/delete) backed by the adapter_deployments operations group in the pre-gen azure-mgmt-cognitiveservices 15.0.0b6 SDK from azure-sdk-for-python#49080 (TypeSpec source: azure-rest-api-specs#46028). SDK pin in setup.py intentionally left at ==15.0.0b4; the pin bump lands in a follow-up PR once the SDK releases to PyPI.

Related command

Description

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


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

…`: Add new command group (preview)

Mirrors the `az cognitiveservices account managed-compute-deployment` pattern from PR Azure#33338. Adds four commands (create/show/list/delete) backed by the `adapter_deployments` operations group in the pre-gen `azure-mgmt-cognitiveservices` 15.0.0b6 SDK from azure-sdk-for-python#49080 (TypeSpec source: azure-rest-api-specs#46028). SDK pin in setup.py intentionally left at ==15.0.0b4; the pin bump lands in a follow-up PR once the SDK releases to PyPI.
Copilot AI lite review requested due to automatic review settings September 22, 2026 06:29
@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi saanikaguptamicrosoft,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-pipelines

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

…0.0b6

The new SDK release exposes the `adapter_deployments` operation group consumed by the `az cognitiveservices account adapter-deployment` command group added in the previous commit. TypeSpec source: azure-rest-api-specs#46028.

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.

Copilot review overview

🟡 Changes recommended

One or more issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 1 Medium severity

Open (3)
What changed in this PR

Adds the preview az cognitiveservices account adapter-deployment CRUD command group, following the managed-compute deployment pattern.

Changes:

  • Adds SDK-backed create, show, list, and delete handlers.
  • Registers the adapter deployment client factory and command group.
  • Adds arguments, help examples, and linter exclusions.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​linter_exclusions.yml Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​custom.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​commands.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_params.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_help.py Updated as part of this pull request.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​_client_factory.py Updated as part of this pull request.

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

Comment thread src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py
Comment thread src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py
…`: Add unit and scenario tests

Adds `test_adapter_deployment.py` mirroring the two-tier pattern from PR Azure#33759 (`test_compute.py`). `CognitiveServicesAdapterDeploymentUnitTests` runs in every CI job with mocked clients and verifies the create wire-payload shape (properties carrying sourceModelId and targetDeploymentName, no sku/tags), that read-only fields don't leak onto outbound payloads, and the LRO return-poller contract for create/delete. `CognitiveServicesAdapterDeploymentScenarioTests` is decorated `@live_only()` and covers the full create/show/list/delete lifecycle end-to-end; skipped in normal CI, requires AZURE_TEST_RUN_LIVE=True plus a pre-provisioned Foundry account, base MCD, and LoRA-fine-tuned Project Model. Placeholder resource identifiers are marked TODO pending service-team access.
@yonzhan

Copy link
Copy Markdown
Collaborator

Cognitive Services

Updated comment for azure-mgmt-cognitiveservices version.
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

…nt for accuracy

The prior comment (inherited from PR Azure#33338 / PR Azure#33759) named a single feature (compute) and a single preview stage (PrPr) as the reason for the beta pin. That is factually incomplete: the beta pin is required because the cognitiveservices CLI module depends on multiple preview-only features that span both PuPr (managed-compute-deployment, adapter-deployment) and PrPr (compute), and preview TypeSpec surfaces only ship in beta SDKs (stable SDKs are generated from GA-only API versions). Downgrading to a stable SDK would break all of them at once, not just compute. Revised comment reflects the union rather than singling out one feature or stage.
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

…9-15-preview`

SDK `azure-mgmt-cognitiveservices==15.0.0b6` (pinned in an earlier commit on this branch) emits `api-version=2026-09-15-preview` by default for all cognitiveservices operation groups. Every existing recording still targets `2026-05-15-preview` (the default in 15.0.0b4), which would cause vcrpy playback to fail on URL mismatch for all 20+ cognitiveservices scenario tests. This is a URL-only find-replace across 25 recording files (182 URLs); response bodies are untouched. Assumes the API-version diff between the two preview versions is additive for the operations these tests exercise. If any test fails on payload-schema mismatch after the SDK PyPI release lands, that specific recording will need to be re-recorded live in a follow-up.
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

…r `doc/authoring_tests.md`

Rewrites the scenario class to comply with the `Test Policies` section of `doc/authoring_tests.md` (DO NOT USE hard-coded or otherwise persistent resources — create resources per-test, tear down after). Matches the pattern used by `test_compute.py` from PR Azure#33759.

Changes:

- Drop the `TEST_ACCOUNT` / `TEST_TARGET_DEPLOYMENT` / `TEST_SOURCE_MODEL_ID` REPLACE_WITH_* placeholders — no hardcoded resource names remain.

- `test_adapter_deployment_list_empty` uses `@ResourceGroupPreparer` + `self.create_random_name` + inline `az cognitiveservices account create` (Foundry AIServices kind, project-management enabled) to provision a fresh account, calls `adapter-deployment list`, asserts empty array, tears down. Recordable end-to-end.

- `test_adapter_deployment_create_show_list_delete` decorated `@live_only()` at the method level and gated by `unittest.skipUnless` on four env vars (`CLITEST_ADAPTER_RESOURCE_GROUP`, `CLITEST_ADAPTER_ACCOUNT`, `CLITEST_ADAPTER_TARGET_DEPLOYMENT`, `CLITEST_ADAPTER_SOURCE_MODEL_ID`). Skipped when env vars are unset. Not recorded because the referenced `sourceModelId` and `targetDeploymentName` are site-specific.

- Class-level `@live_only()` retained for now (mirrors `test_compute.py` from PR Azure#33759). Will lift once recordings are captured against a TIP-family subscription in a follow-up.

Unit tests unchanged; all 6 continue to pass locally.
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants