Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
9643dfc
[Cognitive Services] `az cognitiveservices account adapter-deployment…
saanikaguptamicrosoft Sep 22, 2026
4fa8fd3
[Cognitive Services] Bump `azure-mgmt-cognitiveservices` pin to ==15.…
saanikaguptamicrosoft Sep 22, 2026
fb1d14a
[Cognitive Services] `az cognitiveservices account adapter-deployment…
saanikaguptamicrosoft Sep 22, 2026
603f365
Clarify comment for azure-mgmt-cognitiveservices
saanikaguptamicrosoft Sep 22, 2026
fbd91d7
[Cognitive Services] Rewrite `azure-mgmt-cognitiveservices` pin comme…
saanikaguptamicrosoft Sep 22, 2026
e131e47
[Cognitive Services] Bump `api-version` in test recordings to `2026-0…
saanikaguptamicrosoft Sep 22, 2026
e4a2021
[Cognitive Services] Restructure adapter-deployment scenario tests pe…
saanikaguptamicrosoft Sep 23, 2026
88202b9
Merge dev and retain adapter deployment SDK pin in pyproject
saanikaguptamicrosoft Oct 14, 2026
8d7195a
Fix adapter deployment option length with a compatible alias
saanikaguptamicrosoft Oct 14, 2026
90ba04f
Fix Cognitive Services compute payload for SDK b6
saanikaguptamicrosoft Oct 15, 2026
3f56b6c
Align Compute CLI priorities and async workflow with SDK
saanikaguptamicrosoft Oct 15, 2026
5ccb4e9
Remove unsupported VM priority default claim from help
saanikaguptamicrosoft Oct 15, 2026
381217a
Fix compute wait IndexError by polling via compute_show
saanikaguptamicrosoft Oct 15, 2026
c2f976f
[Cognitive Services] Re-record scenario tests against SDK 15.0.0b6
saanikaguptamicrosoft Oct 20, 2026
c2461d6
Remove stale TIP-region comment from adapter-deployment test
saanikaguptamicrosoft Oct 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def cf_managed_compute_deployments(cli_ctx, *_):
return get_cognitiveservices_management_client(cli_ctx).managed_compute_deployments


def cf_adapter_deployments(cli_ctx, *_):
return get_cognitiveservices_management_client(cli_ctx).adapter_deployments
Comment thread
saanikaguptamicrosoft marked this conversation as resolved.


def cf_computes(cli_ctx, *_):
return get_cognitiveservices_management_client(cli_ctx).computes

Expand Down
84 changes: 84 additions & 0 deletions src/azure-cli/azure/cli/command_modules/cognitiveservices/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,76 @@
--deployment-name gpt-oss-120b-gpu
"""

helps[
"cognitiveservices account adapter-deployment"
] = """
type: group
short-summary: Manage LoRA adapter deployments for Azure Cognitive Services accounts.
long-summary: |
An adapter deployment is a lightweight LoRA weight patch that attaches to an existing
managed compute (parent) deployment. It owns no SKU, capacity, base model, or runtime
- all inference resources come from the parent managed compute deployment referenced
by --target-deployment-name.
"""

helps[
"cognitiveservices account adapter-deployment create"
] = """
type: command
short-summary: Create (or replace / re-target) a LoRA adapter deployment attached to a managed compute deployment.
long-summary: |
The adapter must reference a protected Foundry fine-tuning LoRA output as its source model.
The target deployment is the name of an existing managed compute deployment in the same
account. Re-issuing create with the same adapter name and a different --target-deployment-name
re-targets the adapter; --source-model-id is immutable.
examples:
- name: Create an adapter deployment attached to an existing managed compute deployment.
text: >
az cognitiveservices account adapter-deployment create
-g myResourceGroup -n myAccount
--adapter-deployment-name my-lora-adapter
--source-model-id "azureai://accounts/myAccount/projects/myProject/models/my-fine-tuned-lora/versions/1"
--target-deployment-name gpt-oss-120b-gpu
"""

helps[
"cognitiveservices account adapter-deployment show"
] = """
type: command
short-summary: Show an adapter deployment for Azure Cognitive Services account.
examples:
- name: Show an adapter deployment.
text: >
az cognitiveservices account adapter-deployment show
-g myResourceGroup -n myAccount
--adapter-deployment-name my-lora-adapter
"""

helps[
"cognitiveservices account adapter-deployment list"
] = """
type: command
short-summary: List all adapter deployments for Azure Cognitive Services account.
examples:
- name: List all adapter deployments.
text: >
az cognitiveservices account adapter-deployment list
-g myResourceGroup -n myAccount
"""

helps[
"cognitiveservices account adapter-deployment delete"
] = """
type: command
short-summary: Delete an adapter deployment from Azure Cognitive Services account.
examples:
- name: Delete an adapter deployment.
text: >
az cognitiveservices account adapter-deployment delete
-g myResourceGroup -n myAccount
--adapter-deployment-name my-lora-adapter
"""

helps[
"cognitiveservices commitment-tier"
] = """
Expand Down Expand Up @@ -1042,6 +1112,8 @@
examples:
- name: Create a compute resource.
text: az cognitiveservices account compute create -g MyResourceGroup -n MyAccount --compute-name my-compute --location westus2 --pool-name my-pool --instance-type Standard_DS3_v2 --node-count 1
- name: Create a Spot compute resource without waiting for completion.
text: az cognitiveservices account compute create -g MyResourceGroup -n MyAccount --compute-name my-compute --location westus2 --pool-name my-pool --instance-type Standard_DS3_v2 --node-count 1 --vm-priority Spot --no-wait
"""

helps['cognitiveservices account compute delete'] = """
Expand All @@ -1050,6 +1122,8 @@
examples:
- name: Delete a compute resource.
text: az cognitiveservices account compute delete -g MyResourceGroup -n MyAccount --compute-name my-compute
- name: Delete a compute resource without waiting for completion.
text: az cognitiveservices account compute delete -g MyResourceGroup -n MyAccount --compute-name my-compute --no-wait
"""

helps['cognitiveservices account compute show'] = """
Expand All @@ -1067,3 +1141,13 @@
- name: List compute resources.
text: az cognitiveservices account compute list -g MyResourceGroup -n MyAccount
"""

helps['cognitiveservices account compute wait'] = """
type: command
short-summary: Wait for a compute resource to reach a specified condition.
examples:
- name: Wait for a compute resource to finish creating.
text: az cognitiveservices account compute wait -g MyResourceGroup -n MyAccount --compute-name my-compute --created
- name: Wait for a compute resource to be deleted.
text: az cognitiveservices account compute wait -g MyResourceGroup -n MyAccount --compute-name my-compute --deleted
"""
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from azure.cli.core.util import shell_safe_json_parse, CLIError

from azure.cli.core.commands.validators import validate_tag
from azure.cli.core.commands.validators import get_default_location_from_resource_group, validate_tag
from azure.cli.core.decorators import Completer

from azure.cli.command_modules.cognitiveservices._client_factory import cf_resource_skus
Expand All @@ -26,6 +26,7 @@
KeyName,
DeploymentScaleType,
HostingModel,
VmPriority,
)

logger = get_logger(__name__)
Expand Down Expand Up @@ -690,6 +691,20 @@ def load_arguments(self, _):
with self.argument_context('cognitiveservices account managed-compute-deployment update') as c:
c.argument('tags', tags_type)

with self.argument_context('cognitiveservices account adapter-deployment') as c:
c.argument('adapter_deployment_name',
options_list=['--adapter-deployment-name', '--adapter-name'],
help='Adapter deployment name.')

with self.argument_context('cognitiveservices account adapter-deployment create') as c:
c.argument('source_model_id', options_list=['--source-model-id'],
help='Immutable Foundry fine-tuning LoRA output model URI '
'(e.g., azureai://accounts/{account}/projects/{project}/models/{model}/versions/{version}).')
c.argument('target_deployment_name', options_list=['--target-deployment-name'],
help='Name of the existing managed compute parent deployment (resolved within '
'the same account) that will serve this adapter. Re-specify to re-target an '
'existing adapter deployment.')

with self.argument_context('cognitiveservices account commitment-plan') as c:
c.argument('commitment_plan_name', help='Cognitive Services account commitment plan name')
c.argument('plan_type', help='Cognitive Services account commitment plan type')
Expand Down Expand Up @@ -803,13 +818,16 @@ def load_arguments(self, _):
c.argument('compute_name', help='Cognitive Services account compute name.')

with self.argument_context('cognitiveservices account compute create') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx),
help='Location for the compute resource.')
c.argument(
'location', arg_type=get_location_type(self.cli_ctx), required=False,
validator=get_default_location_from_resource_group,
help='Location for the compute resource. If omitted, uses the configured default '
'location or the resource group location.')
c.argument('pool_name', arg_group='Pool', help='Name of the compute pool.')
c.argument('instance_type', arg_group='Pool',
help='VM instance type for the pool (e.g. Standard_DS3_v2).')
c.argument('node_count', arg_group='Pool', type=int,
help='Number of nodes in the pool.')
c.argument('vm_priority', arg_group='Pool',
help='VM priority for the pool (e.g. Dedicated, LowPriority). '
'If omitted, the service default is used.')
c.argument(
'vm_priority', arg_group='Pool', arg_type=get_enum_type(VmPriority),
help='VM priority for the pool.')
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cf_deleted_accounts, cf_deployments, cf_commitment_plans, cf_commitment_tiers, cf_models, cf_usages, \
cf_ai_projects, cf_account_connections, cf_projects, cf_project_connections, \
cf_managed_network_settings, cf_managed_network_provisions, cf_outbound_rule, \
cf_managed_compute_deployments, cf_computes
cf_managed_compute_deployments, cf_adapter_deployments, cf_computes


def load_command_table(self, _):
Expand Down Expand Up @@ -213,6 +213,19 @@ def load_command_table(self, _):
g.custom_command('update', 'managed_compute_deployment_update')
g.custom_command('delete', 'managed_compute_deployment_delete')

adapter_deployments_type = CliCommandType(
operations_tmpl='azure.mgmt.cognitiveservices.operations#AdapterDeploymentsOperations.{}',
client_factory=cf_adapter_deployments
)

with self.command_group(
'cognitiveservices account adapter-deployment', adapter_deployments_type,
client_factory=cf_adapter_deployments, is_preview=True) as g:
g.custom_command('create', 'adapter_deployment_create')
g.custom_show_command('show', 'adapter_deployment_show')
g.custom_command('list', 'adapter_deployment_list')
g.custom_command('delete', 'adapter_deployment_delete')

computes_type = CliCommandType(
operations_tmpl='azure.mgmt.cognitiveservices.operations#ComputesOperations.{}',
client_factory=cf_computes
Expand All @@ -225,3 +238,4 @@ def load_command_table(self, _):
g.custom_command('delete', 'compute_delete', supports_no_wait=True)
g.custom_show_command('show', 'compute_show')
g.custom_command('list', 'compute_list')
g.custom_wait_command('wait', 'compute_show')
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,43 @@ def managed_compute_deployment_delete(client, resource_group_name, account_name,
return client.begin_delete(resource_group_name, account_name, deployment_name)


def adapter_deployment_create(
client, resource_group_name, account_name, adapter_deployment_name,
source_model_id, target_deployment_name):
"""
Create (or replace / re-target) a LoRA adapter deployment attached to a managed compute deployment.
"""
from azure.mgmt.cognitiveservices.models import AdapterDeployment, AdapterDeploymentProperties
properties = AdapterDeploymentProperties(
source_model_id=source_model_id,
target_deployment_name=target_deployment_name,
)
Comment thread
saanikaguptamicrosoft marked this conversation as resolved.
adapter_deployment = AdapterDeployment(properties=properties)
Comment thread
saanikaguptamicrosoft marked this conversation as resolved.
return client.begin_create_or_update(
resource_group_name, account_name, adapter_deployment_name, adapter_deployment)


def adapter_deployment_show(client, resource_group_name, account_name, adapter_deployment_name):
"""
Show an adapter deployment for Azure Cognitive Services account.
"""
return client.get(resource_group_name, account_name, adapter_deployment_name)


def adapter_deployment_list(client, resource_group_name, account_name):
"""
List adapter deployments for Azure Cognitive Services account.
"""
return client.list(resource_group_name, account_name)


def adapter_deployment_delete(client, resource_group_name, account_name, adapter_deployment_name):
"""
Delete an adapter deployment from Azure Cognitive Services account.
"""
return client.begin_delete(resource_group_name, account_name, adapter_deployment_name)


def commitment_plan_create_or_update(
client,
resource_group_name,
Expand Down Expand Up @@ -2650,6 +2687,7 @@ def compute_begin_create_or_update(
Create a compute resource for Azure Cognitive Services account.
"""
properties = ClusterComputeProperties(
location=location,
pools=[
Pool(
name=pool_name,
Expand All @@ -2659,11 +2697,7 @@ def compute_begin_create_or_update(
)
],
)
# The service also requires the location inside properties (not just on the outer
# Compute envelope). The SDK's ClusterComputeProperties class does not declare
# 'location' as a kwarg, so it is set via the underlying dict-backed model.
properties["location"] = location
resource = Compute(location=location, properties=properties)
resource = Compute(properties=properties)
return sdk_no_wait(
no_wait,
client.begin_create_or_update,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ cognitiveservices account managed-compute-deployment update:
cognitiveservices account managed-compute-deployment delete:
rule_exclusions:
- missing_command_test_coverage
cognitiveservices account adapter-deployment:
rule_exclusions:
- missing_command_test_coverage
cognitiveservices account adapter-deployment create:
rule_exclusions:
- missing_command_test_coverage
cognitiveservices account adapter-deployment show:
rule_exclusions:
- missing_command_test_coverage
cognitiveservices account adapter-deployment list:
rule_exclusions:
- missing_command_test_coverage
cognitiveservices account adapter-deployment delete:
rule_exclusions:
- missing_command_test_coverage
cognitiveservices account compute:
rule_exclusions:
- missing_command_test_coverage
Expand Down

Large diffs are not rendered by default.

Loading
Loading