Conversation
Implements Phase 2 deployment management using the ARM Cognitive Services SDK: - deployment create: Deploy models with SKU, capacity, and RAI policy options - deployment list: Table/JSON output of all deployments - deployment show: Detailed deployment info including model, SKU, and timestamps - deployment delete: Remove deployments with confirmation prompt Features: - Auto-resolves model-source (project ARM resource ID) for custom models - Layered context resolution: flags > azd environment > interactive prompt - User-friendly error handling for 403, 409, and quota errors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds model deployment management capabilities to the azure.ai.models azd extension, enabling users to create, list, show, and delete Azure AI Foundry model deployments via the ARM Cognitive Services SDK, with shared context resolution and structured output.
Changes:
- Added
deploymentcommand group withcreate,list,show, anddeletesubcommands. - Introduced a new ARM-based
DeploymentClientand deployment data models (DeploymentConfig, list/show views). - Updated extension examples and changelog to document deployment operations and context resolution behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/extensions/azure.ai.models/pkg/models/deployment.go | Adds deployment config/result/view models used by commands and client. |
| cli/azd/extensions/azure.ai.models/internal/cmd/root.go | Registers the new deployment command group. |
| cli/azd/extensions/azure.ai.models/internal/cmd/deployment.go | Adds deployment command group + shared context/environment resolution helpers. |
| cli/azd/extensions/azure.ai.models/internal/cmd/deployment_create.go | Implements deployment create including model-source auto-resolution and friendly error messaging. |
| cli/azd/extensions/azure.ai.models/internal/cmd/deployment_list.go | Implements deployment list with table/JSON output. |
| cli/azd/extensions/azure.ai.models/internal/cmd/deployment_show.go | Implements deployment show with table/JSON output. |
| cli/azd/extensions/azure.ai.models/internal/cmd/deployment_delete.go | Implements deployment delete with confirmation prompt / --force. |
| cli/azd/extensions/azure.ai.models/internal/client/deployment_client.go | Adds ARM SDK wrapper for create/list/get/delete deployment operations. |
| cli/azd/extensions/azure.ai.models/extension.yaml | Adds usage examples for deployment commands. |
| cli/azd/extensions/azure.ai.models/CHANGELOG.md | Documents deployment feature additions in 0.0.5-preview. |
| // If still missing critical context, fall back to prompt | ||
| if flags.projectEndpoint == "" { | ||
| customFlags := &customFlags{ | ||
| subscriptionId: flags.subscriptionId, | ||
| projectEndpoint: flags.projectEndpoint, | ||
| } | ||
| if err := promptForProject(ctx, customFlags, azdClient); err != nil { | ||
| return err | ||
| } | ||
| flags.projectEndpoint = customFlags.projectEndpoint | ||
| flags.subscriptionId = customFlags.subscriptionId | ||
| } |
There was a problem hiding this comment.
resolveDeploymentContext falls back to promptForProject(...), but that prompt flow only sets projectEndpoint and subscriptionId (it uses customFlags which has no resource-group field). As a result, when the user has no azd environment configured, the "interactive prompt" path still leaves flags.resourceGroup empty and the subcommands later fail with "resource group is required" even though the prompt already asked for one. Consider adding resource-group to the prompt result (e.g., extend the prompt flow or add a deployment-specific prompt) and set flags.resourceGroup, and update the comment above the function to match the actual behavior.
| default: | ||
| return fmt.Errorf("unsupported output format: %s (supported: table, json)", flags.Output) | ||
| } | ||
|
|
There was a problem hiding this comment.
When --output json is selected, the command still prints the human-readable summary line ("%d deployment(s) found") after emitting JSON, which makes the overall stdout stream not valid JSON for scripting/piping. Consider omitting the summary (and any other non-JSON text) when output is json, or printing summaries to stderr instead.
| // When output is JSON, avoid printing additional human-readable text to stdout | |
| // so that the stdout stream remains valid JSON for scripting/piping. | |
| if flags.Output == "json" { | |
| return nil | |
| } |
This pull request introduces comprehensive support for managing model deployments in the Azure AI Models CLI extension. It adds new commands for creating, listing, showing, and deleting model deployments, leveraging the ARM Cognitive Services SDK. The implementation includes layered context resolution, improved error handling, and user-friendly CLI output.
New deployment management commands:
deployment create,deployment list,deployment show, anddeployment deletecommands to manage model deployments, including support for custom and base models. These commands provide table/JSON output, confirmation prompts, and detailed information. [1] [2] [3] [4] [5]Context and usability improvements:
--model-sourcefor custom model formats based on the current project context, reducing manual configuration. [1] [2]Error handling enhancements:
SDK integration:
DeploymentClientthat wraps the ARM Cognitive Services SDK, encapsulating all deployment-related operations (create, list, show, delete) with clear data models.Command documentation and examples:
extension.yamlto include new command examples for all deployment operations, improving discoverability and ease of use.