Skip to content

fix(ai): conditionally export AKS Bicep infrastructure - #10915

Merged
Yi Liu (yiliuTo) merged 4 commits into
Azure:mainfrom
yiliuTo:yiliuto-conditional-bicep-eject
Nov 13, 2026
Merged

Yi Liu (yiliuTo) merged 4 commits into
Azure:mainfrom
yiliuTo:yiliuto-conditional-bicep-eject

Conversation

@yiliuTo

Copy link
Copy Markdown
Member

Summary

  • Select Bicep export mode from synthesized agentHosting, independently of the BYO AKS preview switch.
  • Omit AKS-only parameters, preview account resources, and byo-* modules from non-AKS exports while preserving networking, monitoring, registry selection, custom modules, and existing-project paths.
  • Share .bicep.tmpl sources between conditional exports and generation of the complete embedded provisioning graph. Full-mode Bicep and generated ARM JSON remain unchanged.

Related to #10864.

Validation

  • Go 1.26.4: standalone synthesis go test ./... -count=1.
  • Agents: go test ./internal/cmd ./internal/project -count=1.
  • Projects parent module: go test ./... -count=1.
  • Native Bicep 0.48.1 compilation, including seven greenfield export cases and existing-project registry modes; generated parameter names match compiled declarations.
  • go generate reproduces the current full Bicep and ARM JSON without changes.
  • golangci-lint 2.11.4: synthesis and affected Agents packages, zero issues; changed Go files are gofmt-clean. go fix -diff reports only an unrelated pre-existing modernization in synthesis/monitoring_discovery_test.go; no changes were applied there.

No Azure deployment or interactive scenario was run. Relevant optional offline scenario: cli/azd/extensions/azure.ai.agents/tests/cli-interactive-tester-scenarios/tier0/0.34-init-byo-aks-infra.yaml, through the foundry-extension-scenario-orchestrator agent.

Render shared Bicep sources according to synthesized agent hosting while retaining the complete embedded provisioning graph.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
24 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 ext-agents azure.ai.agents extension ext-projects azure.ai.projects extension labels Nov 12, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟑 Changes recommended

The Projects Bicep exporter still emits the full AKS graph and raw template sources for non-AKS projects, while documentation omits the regeneration and parameter requirements for enabling AKS after export.

2 open issues
What changed in this PR

This PR makes the Agents extension’s Foundry Bicep export conditional on AKS hosting, while sharing template sources with Projects’ embedded provisioning graph.

Changes:

  • Omit AKS-only parameters, resources, and modules from non-AKS Agents exports.
  • Generate the full embedded Bicep graph from shared conditional templates.
  • Expand export and parity tests, and document export modes and regeneration.

Extension user-contract review: complete (9 files inspected; 0 new contract comments; 0 existing threads).

File Description
cli/​azd/​extensions/​azure.ai.projects/​synthesis/​templates/​modules/​resources.bicep.tmpl Conditionally includes AKS resources and hosting bindings.
cli/​azd/​extensions/​azure.ai.projects/​synthesis/​templates/​modules/​acr.bicep.tmpl Conditionally includes AKS registry parameters and kubelet grants.
cli/​azd/​extensions/​azure.ai.projects/​synthesis/​templates/​main.bicep.tmpl Conditionally includes AKS parameters and module inputs.
cli/​azd/​extensions/​azure.ai.projects/​synthesis/​templates_embed.go Embeds and renders shared templates; adds generation wiring.
cli/​azd/​extensions/​azure.ai.projects/​synthesis/​templates_embed_test.go Checks full-mode rendering against embedded Bicep sources.
cli/​azd/​extensions/​azure.ai.projects/​synthesis/​internal/​generatebicep/​main.go Generates full Bicep sources from shared templates.
cli/​azd/​extensions/​azure.ai.projects/​README.md Documents conditional exports and regeneration.
cli/​azd/​extensions/​azure.ai.agents/​internal/​cmd/​init_infra.go Selects hosting mode and renders or filters exported files.
cli/​azd/​extensions/​azure.ai.agents/​internal/​cmd/​init_infra_test.go Expands export-mode, file-filtering, and compilation coverage.

Review effort: Max

@yiliuTo
Yi Liu (yiliuTo) enabled auto-merge (squash) November 12, 2026 09:07
Clarify behavior of Bicep eject with AKS parameters and agentHosting configuration. Explain requirements for non-AKS Bicep export and BYO AKS deployment.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI max review requested due to automatic review settings November 12, 2026 09:13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

πŸ”΅ Needs a closer look

The Projects Bicep exporter lacks hosting-aware rendering and filtering, causing it to copy raw .bicep.tmpl files and include AKS-only infrastructure in non-AKS exports.

No open issues πŸŽ‰

3 previously missed issues

In code that hasn't changed since last review

Medium severity Reject AKS configuration unsupported by the exported graph

cli/​azd/​extensions/​azure.ai.projects/​README.md:390

After a non-AKS export, adding agentHosting to azure.yaml is silently ignored, so provisioning can succeed without using the selected AKS cluster. This conflicts with cli/azd/extensions/AGENTS.md:87-89, which requires rejecting unsupported authored configuration. Detect this mismatch before provisioning and return an error explaining that the exported graph needs AKS support.

Medium severity Render and filter Bicep templates in the Projects exporter

cli/​azd/​extensions/​azure.ai.projects/​synthesis/​templates_embed.go:26

Projects Bicep eject still copies TemplatesFS() verbatim through copyEmbeddedBicep in azure.ai.projects/internal/cmd/project_add.go:2169. It now writes raw .bicep.tmpl files and still gives non-AKS projects the full AKS graph, contrary to the new documented eject behavior. Apply the same synthesized-hosting selection, rendering, and filtering to that exporter.

Low severity Tell contributors to edit the Bicep template sources

cli/​azd/​extensions/​azure.ai.projects/​synthesis/​templates_embed.go:16

The first generation step overwrites main.bicep, modules/resources.bicep, and modules/acr.bicep from their .bicep.tmpl sources, so following this advice after editing those .bicep files discards the edits. State explicitly that contributors must edit the corresponding .tmpl files; only non-generated .bicep files should be edited directly.

2 resolved since last review

Review effort: Max

Copilot AI max review requested due to automatic review settings November 12, 2026 09:36
@azure-sdk-automation

Copy link
Copy Markdown
Contributor

azure.ai.projects PR build

Note

This is an unsigned development build. Install it only if you trust this PR.

Install the extension:

azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10915/azure-ai-projects.zip"
  • Version: 1.1.0-pr.10915.7069088
  • Merge commit: 02e07a2

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

azure.ai.agents PR build

Note

This is an unsigned development build. Install it only if you trust this PR.

Install the extension:

azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10915/azure-ai-agents.zip"
  • Version: 1.1.0-pr.10915.7069087
  • Merge commit: 02e07a2

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.

🟑 Changes recommended

An authored agentHosting setting can be silently discarded when the template lacks support, allowing provisioning to succeed on Foundry hosting instead of the selected AKS cluster.

1 open issue

Review effort: Max

@yiliuTo
Yi Liu (yiliuTo) merged commit fff782c into Azure:main Nov 13, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.agents extension ext-projects azure.ai.projects extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants