Skip to content

feat: add Foundry project ownership core - #9559

Open
Hui Miao (huimiu) wants to merge 2 commits into
mainfrom
hui/foundry-projects-core
Open

feat: add Foundry project ownership core#9559
Hui Miao (huimiu) wants to merge 2 commits into
mainfrom
hui/foundry-projects-core

Conversation

@huimiu

@huimiu Hui Miao (huimiu) commented Aug 13, 2026

Copy link
Copy Markdown
Member

Closes #9564

Why this is needed

azure.ai.projects already owns provisioning for host: azure.ai.project, but project authoring and reconciliation were still split across extensions. That made standalone project setup harder and left project identity, endpoints, managed deployments, and environment state with inconsistent ownership.

What this PR does

This PR moves the core project authoring flow into azure.ai.projects:

  • Adds azd ai project init to create a new project, adopt an existing project by ARM resource ID, or configure an existing project endpoint.
  • Adds azd ai project deployment add to select and record managed model deployments in the project service.
  • Adds a versioned delegated request contract for agent-driven calls.
  • Resolves project identity and Azure context, updates project-owned environment values, and keeps legacy project service entries working.
  • Enforces project ID requirements for existing-project reconciliation and delegated location restrictions.
  • Supports optional Bicep or Terraform infrastructure ejection, with cleanup and configuration rollback when an update fails.
  • Documents the greenfield, existing-project, and endpoint-only flows and adds regression coverage.

Why this approach

The extension that owns host: azure.ai.project should also own its service configuration. Keeping project initialization and deployment authoring as separate commands lets a project exist without a model deployment, while the delegated contract lets higher-level flows orchestrate both operations when needed.

Scope

This PR implements the projects-side ownership core. The Agents handoff, recording proxy, and infrastructure layering work remain separate follow-ups.

Validation

  • go test ./... from cli/azd/extensions/azure.ai.projects

Related to #9085 and based on the ownership design in #9441.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
20 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the ext-projects azure.ai.projects extension label Aug 13, 2026
@github-actions

Copy link
Copy Markdown

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Thank you for logging this issue; our team is reviewing it. If you need urgent prioritization, tag Rick Winter (@RickWinter) and Kristen Womack (@kristenwomack) to let us know.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
20 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Pull request overview

Adds Foundry project ownership and authoring to azure.ai.projects.

Changes:

  • Adds project initialization, adoption, and infrastructure ejection.
  • Adds managed model deployment authoring.
  • Adds delegated contracts, reconciliation, environment updates, and tests.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/exterrors/errors.go Adds compatibility errors.
internal/cmd/root.go Registers new commands.
internal/cmd/project_service_reconciler.go Reconciles project services.
internal/cmd/project_ownership_test.go Adds ownership-flow tests.
internal/cmd/project_init.go Implements project initialization and ejection.
internal/cmd/project_environment.go Manages project environment state.
internal/cmd/project_deployment.go Selects and reconciles deployments.
internal/cmd/project_deployment_add.go Implements deployment addition.
internal/cmd/delegated_contract.go Defines delegated request contracts.
go.mod Promotes RPC types to a direct dependency.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +150 to +155
if values["AZURE_AI_PROJECT_ID"] == "" {
return exterrors.Validation(
"project_deployment_requires_id",
"managed model deployments require an existing Foundry project resource ID",
"rerun `azd ai project init --project-id <resource-id>` after the project is provisioned",
)
Comment on lines +656 to +658
func validateAllowedProjectLocation(project *resolvedProject, allowed []string) error {
if project == nil || len(allowed) == 0 || project.Location == "" {
return nil
Comment on lines +36 to +37
rootCmd.AddCommand(newProjectInitCommand(extCtx))
rootCmd.AddCommand(newProjectDeploymentCommand(extCtx))
Comment on lines +1109 to +1112
if _, err := client.Project().UnsetConfig(ctx,
&azdext.UnsetProjectConfigRequest{Path: "infra.path"}); err != nil {
_ = os.RemoveAll(infraDir)
return fmt.Errorf("remove infra.path: %w", err)
Copilot AI review requested due to automatic review settings August 13, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-projects azure.ai.projects extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden the Foundry project ownership flow

2 participants