fix: auto-detect foundry provisioning provider for unified yaml#8846
fix: auto-detect foundry provisioning provider for unified yaml#8846huimiu wants to merge 1 commit into
Conversation
3488b80 to
1c5af40
Compare
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
There was a problem hiding this comment.
Pull request overview
Fixes azd provision (including --preview) for unified azure.yaml projects that declare extension-owned service hosts (e.g., Foundry) but have no infra.provider and no on-disk IaC, by auto-selecting an installed extension provisioning provider and ensuring the resolved provider name is forwarded into provider initialization.
Changes:
- Add core auto-detection in
DefaultProviderResolverto route to an installed extension’s provisioning provider when the project uses that extension’s service hosts and no IaC provider is specified. - Add
ProvisioningProviderTypeto the extensions registry model to identify provisioning-provider entries. - Ensure the resolved provider kind is written back into provisioning options so
Provider.Initializereceives the concrete provider name; add tests for both the mapping and the forwarding behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/infra/provisioning/manager.go | Writes resolved provider kind back onto options before resolving/initializing provider. |
| cli/azd/pkg/infra/provisioning/manager_test.go | Adds a test provider to assert resolved provider kind reaches Provider.Initialize. |
| cli/azd/pkg/extensions/registry.go | Adds ProvisioningProviderType constant for extension provider registration metadata. |
| cli/azd/pkg/azd/default.go | Implements extension-based default IaC provider selection when infra.provider is unspecified. |
| cli/azd/pkg/azd/default_test.go | Adds table tests for deterministic host→extension provisioning provider selection and fallbacks. |
| installed, err := extensionManager.ListInstalled() | ||
| if err != nil { | ||
| return "", false | ||
| } |
Summary
Fixes #8819. With a unified
azure.yamlthat declares Foundry services (host: azure.ai.project,azure.ai.agent, …) but noinfra.providerand no on-diskinfra/directory,azd provision(including--preview) failed with:Root cause
When
infra.provideris unset and no IaC files are found, the provisioning manager'sDefaultProviderResolverunconditionally returnedbicep, so core's Bicep provider tried to compile a non-existentinfra/main.bicep. The extension'smicrosoft.foundryprovider (which synthesizes Bicep in-memory, noinfra/needed) was never reached, because core only routes to it wheninfra.provider: microsoft.foundryis set.Fix
Core-level auto-detection — generic, with no hard-coded provider/host names:
pkg/azd/default.go— theDefaultProviderResolvernow lazily resolves the project config and installed extensions. Wheninfra.provideris unset and no on-disk IaC is present, it defaults to an installed extension's provisioning provider whose service host the project uses. This maps a unified Foundryazure.yamltomicrosoft.foundryand generalizes to any extension that registers both aservice-targetand aprovisioning-provider. Falls back tobicepwhen nothing applies or no project/extension context is available.pkg/extensions/registry.go— add theProvisioningProviderTypeprovider-type constant.pkg/infra/provisioning/manager.go—newProviderwrites the resolved provider name back onto the options so the provider'sInitialize(the extension validates it over gRPC) receives the concrete name instead of an unspecified value.Tests
pkg/azd/default_test.go— table tests for the host → provider mapping helper (foundry →microsoft.foundry; missing capability / extension / host → fallback; deterministic multi-extension selection).pkg/infra/provisioning/manager_test.go— asserts the resolved provider reachesProvider.Initialize.Validation
go build ./...,go vet,gofmt,cspell, andgolangci-lintare clean; tests pass forpkg/azd,pkg/infra/provisioning,pkg/extensions, andinternal/cmd.Out of scope
The example
azure.yamlfiles are unchanged (auto-detect only).