Skip to content

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

Merged
JaysonTaiMicrosoft merged 15 commits into
Azure:devfrom
saanikaguptamicrosoft:saanika/adapter-deployment-cli
Oct 21, 2026
Merged

JaysonTaiMicrosoft merged 15 commits into
Azure:devfrom
saanikaguptamicrosoft:saanika/adapter-deployment-cli

Conversation

@saanikaguptamicrosoft

@saanikaguptamicrosoft saanikaguptamicrosoft commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests
⚠️ None ️✔️ 130/130
⚠️AzureCLI-BreakingChangeTest
⚠️cognitiveservices
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd cognitiveservices account adapter-deployment sub group cognitiveservices account adapter-deployment added
⚠️ 1009 - ParaPropRemove cognitiveservices account compute create cmd cognitiveservices account compute create update parameter location: removed property required=True
⚠️ 1008 - ParaPropAdd cognitiveservices account compute create cmd cognitiveservices account compute create update parameter vm_priority: added property choices=['Regular', 'Spot']
⚠️ 1001 - CmdAdd cognitiveservices account compute wait cmd cognitiveservices account compute wait added

Dependencies

Merge and release of this SDK PR: Azure/azure-sdk-for-python#49463

Related command

  • az cognitiveservices account adapter-deployment create -g madhurta-uksouth -n manishda-uksouth-resource --adapter-deployment-name saanika-test-adapter-02 --source-model-id "azureai://accounts/manishda-uksouth-resource/projects/manishda-uksouth/models/model_9c2b3d1b-final/versions/1" --target-deployment-name gpt-oss-120b
  • az cognitiveservices account adapter-deployment list -g madhurta-uksouth -n manishda-uksouth-resource
  • az cognitiveservices account adapter-deployment show -g madhurta-uksouth -n manishda-uksouth-resource --adapter-deployment-name saanika-test-adapter-02
  • az cognitiveservices account adapter-deployment delete -g madhurta-uksouth -n manishda-uksouth-resource --adapter-deployment-name saanika-test-adapter-02

Description
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 azure-mgmt-cognitiveservices 15.0.0b6 SDK (TypeSpec source: azure-rest-api-specs#46028).

Also updates the existing Compute commands for SDK 15.0.0b6: location is now sent inside properties, --location is optional (falls back to the configured default, then the resource group location), --vm-priority accepts only Regular and Spot, and a new compute wait command is added to fix the linter.

Testing Guide

image
  • Create command
image
  • List command
image
  • Show command
image
  • Delete command
image

History Notes


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

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

`az cognitiveservices account compute wait` raised IndexError before sending any request.

Behavior change:
- `compute wait` is now registered with custom_wait_command('wait', 'compute_show') instead of the generic wait_command('wait').
- The generic getter called the decorated SDK ComputesOperations.get with `self` passed as a keyword. The SDK api_version_validation wrapper reads args[0], so it raised IndexError before any HTTP request.
- Polling now goes through compute_show, which calls client.get(...) on the bound client.

Unchanged: no new commands, flags or options. The wait conditions (--created, --updated, --deleted, --exists, --custom, --timeout, --interval) still come from the core wait command. Compute create, delete, show and list are untouched.

Verification:
- Offline, real CLI entry point + real decorated SDK GET, HTTP pipeline mocked: Succeeded + --created exits 0; Failed + --created exits 1 with "The operation failed"; Failed + --exists exits 0; absent + --deleted (GET 404) exits 0.
- Live (manual): wait on a compute in Failed state reaches the GET and reports "The operation failed".
- Not verified: wait --created on a live compute that transitions to Succeeded (create is currently rejected by the backend SKU policy). No regression test is included in this commit.
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@JaysonTaiMicrosoft JaysonTaiMicrosoft added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Oct 19, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-experience-enablement-squad.

@x-engineering-agent

x-engineering-agent Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

X Engineering Agent Report

Review — Comments

saanikaguptamicrosoft

No confirmed semantic defects found in Azure/azure-cli PR #34112 at c2461d653cf0bcb1b308e406c7193dd5ab13a401. All three upstream CI checks passed, but regression coverage for the required scenario is not verified.

  • Inspected: Adapter create/list/show/delete registration, argument forwarding, request construction and poller returns; compute location/defaulting and priority changes; SDK dependency and recording updates.
  • Adapter coverage: src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_adapter_deployment.py:154 applies @live_only() to the entire scenario class, including empty-list coverage. Ordinary playback skips it, as confirmed by src/azure-cli-testsdk/azure/cli/testsdk/scenario_tests/decorators.py:13-16. The lifecycle test at line 203 additionally requires four documented CLITEST_ADAPTER_* inputs. Mock tests check payloads and delegation, not service behavior. The author's screenshots are separate evidence, not Agent live-test results.
  • Recording scope: The SDK upgrade affects the shared management client. Existing fixtures—including src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_deployment.yaml—change requests from 2026-05-15-preview to 2026-09-15-preview; none of the 25 recording files covers adapter operations.
  • Focused validation: With the documented pre-provisioned resources and environment variables, run azdev test cognitiveservices.test_adapter_deployment --live at this head and confirm both scenarios actually execute. For repeatable empty-list playback coverage, make that scenario recordable and add src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_adapter_deployment_list_empty.yaml, then rerun without --live. A recording alone will not overcome the class-level skip. Also replay azdev test cognitiveservices.test_cognitiveservices_deployment against the upgraded SDK; re-record that fixture if requests or responses differ.
Test validation
  • Agent live test: Not run; this is a review-only PR. Check author-provided test evidence and upstream CI separately.
  • Regression coverage: For cognitiveservices: 13 focused test file(s) and 25 recording file(s) changed. Scenario coverage is unverified; review the issue's required conditions, test setup, and assertions before approval. No linked issue was found in the PR timeline; inspect the source issue and its required scenario manually.
Risk assessment — 31/100 · Medium

The Medium rating is driven by public CLI behavior.

  • Change scope: 48 changed files, 13462 changed lines (+8251 / -5211), including 5 production files.
  • Affected components: cognitiveservices
  • Risk drivers: public CLI behavior (+18)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is recommended for cognitiveservices before merge.

Posted by x-engineering-agent (Reviewer)

@JaysonTaiMicrosoft

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@JaysonTaiMicrosoft

Copy link
Copy Markdown
Contributor

saanikaguptamicrosoft A number of recording files were updated. As this is a sdk bump please ensure that you have re-recorded all effected scenario tests to ensure there are no regressions azdev test .... --live. Refer https://github.com/Azure/azure-cli/blob/dev/doc/authoring_tests.md#automating-tests-for-azure-cli for additional guidance.

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Oct 20, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-experience-enablement-squad.

Re-recorded 21 existing Cognitive Services scenario recordings live with
azure-mgmt-cognitiveservices 15.0.0b6 (api-version 2026-09-15-preview),
replacing the earlier URL-only api-version edits. All 21 replay offline.

The service now returns account locations in lowercase, so tests that
created accounts with an uppercase location and asserted the same value
now use the lowercase form.

Not re-recorded (keep the api-version-only edit): deployment (model
gpt-35-turbo 0125 is deprecated), user_owned_storage (account kind
Storage is no longer supported), and the two connections from_file tests
(data file path fails to load on Windows).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JaysonTaiMicrosoft

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

The 2026-09-15-preview API version is now released, so the note about TIP
regions and the pending TSP PR no longer applies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JaysonTaiMicrosoft

Copy link
Copy Markdown
Contributor

/azp run

@JaysonTaiMicrosoft JaysonTaiMicrosoft removed Request X Engineering Agent Ask the agent to triage this issue or review this PR X Engineering Agent Reviewed Agent reviewed this PR labels Oct 20, 2026
@azure-pipelines

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

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Oct 20, 2026
@JaysonTaiMicrosoft
JaysonTaiMicrosoft merged commit 81ddb6c into Azure:dev Oct 21, 2026
61 checks passed
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.

7 participants