feat: add Foundry project ownership core - #9559
Conversation
|
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. |
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
|
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. |
There was a problem hiding this comment.
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.
Travis Angevine (trangevi)
left a comment
There was a problem hiding this comment.
I'm concerned about adding new commands before we have closure on the new proposed end to end path which John has been working on. Let's sync on that before moving forward with the new commands here
| if len(body) == 1 { | ||
| return nil | ||
| } | ||
| if _, err := r.client.Project().SetServiceConfigSection( |
There was a problem hiding this comment.
azd-code-reviewer: Can we make creation of the replacement service atomic, or remove the host-only service if this second write fails? During legacy migration, AddService can succeed and this call can fail, leaving an azure.ai.project service with none of the copied deployments/hooks/config. On retry, discovery prefers that incomplete project service over the legacy service, so the migration reports success without ever copying the legacy configuration, and the Foundry provider then ignores the still-complete legacy host.
| return err | ||
| } | ||
| } | ||
| if err := reconcileProjectEnvironment( |
There was a problem hiding this comment.
azd-code-reviewer: Please make the infrastructure and environment updates atomic or explicitly retryable. If an environment SetValue/UnsetValue fails here after root Terraform ejection succeeds, azure.yaml has already switched to terraform and infra/ exists. A retry cannot finish reconciliation: project init rejects the now-non-Foundry root provider (and --infra also encounters the existing directory). Rolling back ejection on this error, or recognizing the matching completed ejection on retry, would avoid stranding the project after a transient environment write failure.
| azureContext.Scope.Location = values["AZURE_LOCATION"] | ||
| } | ||
| if azureContext.Scope.SubscriptionId == "" { | ||
| if deploymentContext, contextErr := client.Deployment().GetDeploymentContext( |
There was a problem hiding this comment.
azd-code-reviewer: This fallback cannot actually recover a missing subscription: GetDeploymentContext reads the same selected environment's AZURE_SUBSCRIPTION_ID, so it remains empty. It also replaces already resolved AZURE_TENANT_ID and AZURE_AI_DEPLOYMENTS_LOCATION with the deployment context's values (whose location comes from AZURE_LOCATION), and its error is ignored. The command then reaches catalog/quota calls with an empty subscription and possibly the wrong location. Please resolve or prompt for the missing subscription (and fail deterministically in --no-prompt) while preserving the other fields rather than replacing the whole context.
Closes #9564
Why this is needed
azure.ai.projectsalready owns provisioning forhost: 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:azd ai project initto create a new project, adopt an existing project by ARM resource ID, or configure an existing project endpoint.azd ai project deployment addto select and record managed model deployments in the project service.Why this approach
The extension that owns
host: azure.ai.projectshould 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.
Related to #9085 and based on the ownership design in #9441.