Skip to content

Adding model deployment #7283

Open
achauhan-scc wants to merge 10 commits intoAzure:mainfrom
achauhan-scc:model-enhancement
Open

Adding model deployment #7283
achauhan-scc wants to merge 10 commits intoAzure:mainfrom
achauhan-scc:model-enhancement

Conversation

@achauhan-scc
Copy link
Member

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:

  • Added deployment create, deployment list, deployment show, and deployment delete commands 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:

  • Implemented layered context resolution for deployment commands: explicit flags, azd environment, or interactive prompt, ensuring a smooth user experience even if some parameters are missing. [1] [2]
  • Auto-resolves --model-source for custom model formats based on the current project context, reducing manual configuration. [1] [2]

Error handling enhancements:

  • Added user-friendly error messages for common issues such as RBAC/403 errors, deployment name conflicts (409), and quota/capacity problems, with actionable guidance and documentation links. [1] [2]

SDK integration:

  • Introduced a new DeploymentClient that wraps the ARM Cognitive Services SDK, encapsulating all deployment-related operations (create, list, show, delete) with clear data models.

Command documentation and examples:

  • Updated extension.yaml to include new command examples for all deployment operations, improving discoverability and ease of use.

achauhan-scc and others added 10 commits March 12, 2026 15:33
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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 deployment command group with create, list, show, and delete subcommands.
  • Introduced a new ARM-based DeploymentClient and 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.

Comment on lines +94 to +105
// 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
}
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
default:
return fmt.Errorf("unsupported output format: %s (supported: table, json)", flags.Output)
}

Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants