Skip to content

Add read-only preflight for existing AKS Foundry hosting - #10828

Open
Yi Liu (yiliuTo) wants to merge 4 commits into
Azure:mainfrom
yiliuTo:yiliuto-byo-aks-preflight-main
Open

Yi Liu (yiliuTo) wants to merge 4 commits into
Azure:mainfrom
yiliuTo:yiliuto-byo-aks-preflight-main

Conversation

@yiliuTo

Copy link
Copy Markdown
Member

Summary

  • Add a read-only preflight before Foundry ARM deployments and previews that use an existing AKS cluster. Report resource compatibility, AKS prerequisites, selected network/subnet requirements, and identity/operator authorization at the effective deployment scopes.
  • Derive the preflight plan from the actual compiled template and merged parameters, including customized on-disk Bicep, nested deployments, supplied supporting resources, and cross-subscription scopes. Report unsupported runtime dependencies as warnings and skip only dependent checks; block deployment and preview on failed mandatory checks.
  • Preserve the contracts in Support independently supplied BYO AKS supporting resources #10824: explicit parameter bindings and ARM parameter envelopes, optional supporting-resource selections, identical hosting/workload identities, actual kubelet validation, and private Foundry networking with an authenticated public container registry. Keep the existing deployment templates and ordinary provisioning/teardown paths unchanged.
  • Document the checks, limitations, and remediation behavior. Cover default and supplied-resource combinations, customized templates, authorization, network checks, write gates, and upstream compatibility regressions.

Validation

  • Built both azure.ai.projects and azure.ai.agents.
  • Passed the complete Projects extension suite: go test ./... -count=1. The color-sensitive command tests require NO_COLOR to be unset at process startup.
  • Passed the complete Agents synthesis suite and the Agents command infrastructure tests selected by Infra|BYOAKS|BYOAks.
  • Used an explicit Bicep executable for native compilation and embedded-template parity tests.
  • No live Azure deployment or end-to-end cluster validation was performed. Windows-specific symlink tests were skipped where symlink creation was unavailable. The full repository preflight/lint suite was not run.

Related: #10824.

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 3, 2026

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

Critical preflight gaps let customized AKS deployments skip validation and can falsely confirm role-assignment authorization by accepting unevaluated conditions or checking the wrong scope.

5 open issues
What changed in this PR

Adds a read-only preflight to the Foundry provisioning provider’s existing-AKS deployment and ARM what-if paths, building on #10824’s supplied-resource support without changing deployment templates or teardown behavior.

Changes:

  • Derives resources, grants, and operation scopes from compiled ARM templates and merged parameters.
  • Adds AKS, supporting-resource, networking, and authorization checks with mandatory-failure gates.
  • Adds compatibility tests, shared Bicep test utilities, Azure SDK dependencies, and documentation.

This pull request requires changes. Unresolved findings cover customized-template preflight bypasses, conditional and group-derived authorization, incorrect permission scopes, unsupported child-resource grants, evidence classification and reporting, warning persistence, production-path test coverage, unused code, and feature-stage documentation.

File Description
docs/​reference/​feature-status.md Records existing-AKS hosting maturity and preflight support.
docs/​guides/​creating-an-extension.md Links the read-only provisioning-provider example.
docs/​architecture/​extension-framework.md Describes Foundry preflight integration.
cli/​azd/​extensions/​azure.ai.projects/​README.md Documents checks, permissions, limitations, and remediation.
cli/​azd/​extensions/​azure.ai.projects/​internal/​testutil/​bicep.go Centralizes local Bicep discovery and version validation.
cli/​azd/​extensions/​azure.ai.projects/​internal/​synthesis/​templates_embed.go Clarifies preflight’s runtime Bicep usage.
cli/​azd/​extensions/​azure.ai.projects/​internal/​synthesis/​schema_test.go Reuses shared Bicep test helpers.
cli/​azd/​extensions/​azure.ai.projects/​internal/​synthesis/​hosting_test.go Updates Bicep-helper test calls.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​onboarding_naming.go Evaluates constant naming functions through Bicep.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​onboarding_naming_test.go Tests naming evaluation, failures, and cleanup.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​foundry_provisioning_provider.go Passes progress callbacks into preflight preparation.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​byo_template_plan.go Resolves compiled resources, nested deployments, and scopes.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​byo_template_plan_test.go Tests nested names, scopes, and references.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​byo_plan_bindings.go Maps resources, grants, and network operations into preflight.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​aks_hosting.go Runs preflight and reports results before binding resolution.
cli/​azd/​extensions/​azure.ai.projects/​internal/​provisioning/​aks_hosting_compatibility_test.go Covers binding contracts and customized-template compatibility.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​types.go Defines plans, evidence, reports, and blocking errors.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​resource_sdk.go Collects read-only Azure resource evidence.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​resource_rules.go Implements AKS, AgentPool, and Storage compatibility rules.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​resource_clients.go Shares ARM clients within a preflight pass.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​plan.go Parses resource IDs and provides test-used plan construction.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​pipeline.go Combines resource and authorization checks with deployment gating.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​parallel_reads.go Bounds concurrent evidence reads.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​operator_authorization.go Checks operator permissions and role-assignment authority.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​network_sdk.go Reads selected subnets and parent VNets.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​network_configuration.go Checks subnet delegation, capacity, containment, and overlap.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​managed_node_network.go Resolves managed node subnets through VMSS evidence.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​identity_authorization.go Evaluates supplied-identity grants and permissions.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​deployment_plan.go Models standard-network operations and permission scopes.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​authorization_test.go Tests authorization scopes, inheritance, caching, and failures.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​authorization_sdk.go Coordinates authorization evidence and scoped operation checks.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​authorization_rules.go Defines grant requirements, action matching, and caller claims.
cli/​azd/​extensions/​azure.ai.projects/​internal/​onboarding/​authorization_evidence.go Caches authorization evidence within each pass.
cli/​azd/​extensions/​azure.ai.projects/​go.sum Records added Azure SDK dependency checksums.
cli/​azd/​extensions/​azure.ai.projects/​go.mod Adds Compute, Network, and Storage SDK dependencies.
cli/​azd/​extensions/​azure.ai.agents/​README.md Links existing-AKS preflight documentation.
cli/​azd/​extensions/​azure.ai.agents/​internal/​synthesis/​templates_embed.go Mirrors the Projects runtime-Bicep comment update.
cli/​azd/​.vscode/​cspell.yaml Adds file-scoped preflight terminology.

Review effort: Max

check.Missing = "operator object ID"
return check
}
check.Status, check.Observed, check.Cause = a.basicAction(ctx, scope, caller, roleAssignmentWrite, false)
Comment on lines +117 to +120
plan, err := p.identifyBYOTemplatePlan(ctx, source)
if err != nil {
return err
}
Comment on lines +309 to +313
if checkID == "P07" {
if grant.Missing != "" {
plan.RegistryGrantMissing = grant.Missing
} else {
plan.RegistryGrantPlanned = new(true)
Comment on lines +172 to +173
if output.Len() > 0 {
progress(output.String())
Comment on lines +347 to +350
if node.env.scope.groupExists {
return node.env.scope.groupARMID
}
return node.env.scope.subscriptionARMID
Preserve registry lifecycle validation, process feature gates, and parallel binding reads alongside read-only preflight.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI max review requested due to automatic review settings November 5, 2026 07:14

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.

Comment on lines +170 to +173
token, tokenErr := a.credential.GetToken(ctx, policy.TokenRequestOptions{
Scopes: []string{strings.TrimRight(audience, "/") + "/.default"},
})
caller, identityErr = identityFromToken(token.Token)
Comment on lines +42 to +46
future := grant.checkID == "G02" && !plan.Workload.Supplied && facts.absent(plan.Workload) ||
grant.checkID == "G03" && !plan.Storage.Supplied && facts.absent(plan.Storage)
if future {
report = append(report, resourceResult(check, NotApplicable,
"dependency does not yet exist; the same ARM graph will create the dependency and grant"))
return Unverified, "operator role assignments could not be read", err
}
provenAssignments := map[*armauthorization.RoleAssignment]bool{}
if caller.groupOverage {
Comment on lines +105 to +107
if unconditionalOnly && (authString(p.Condition) != "" || authString(p.ConditionVersion) != "" ||
authString(p.DelegatedManagedIdentityResourceID) != "") {
continue
Comment on lines +38 to +41
segments := 9
if strings.EqualFold(resourceType, "Microsoft.Network/virtualNetworks/subnets") {
segments = 11
}
Comment on lines +403 to +405
joinScope := resource.ID
if !resource.Supplied {
joinScope = vnet
Comment on lines +405 to +408
joinScope = vnet
if resource.LifecycleMissing == "" {
plan.AddOperation("P03", "Microsoft.Network/virtualNetworks/subnets/write", vnet)
}
return nil, err
}
if err := p.prepareBYO(ctx, src); err != nil {
if err := p.prepareBYO(ctx, src, progress); err != nil {
Comment on lines +34 to +49
// CheckClusterDeployment checks deployment-write permission in the AKS resource group without checking supporting resources.
func CheckClusterDeployment(
ctx context.Context, clusterID string, credential azcore.TokenCredential, options *arm.ClientOptions,
) (Report, error) {
cluster, err := ParseID(clusterID, "Microsoft.ContainerService/managedClusters")
if err != nil {
return nil, err
}
a := &scopedAuthorizer{credential: credential, options: onboardingARMOptions(options)}
a.reads = newAuthorizationEvidence(a.credential, a.options)
caller, tokenErr, identityErr := a.operatorIdentity(ctx)
report := a.checkOperations(ctx, []operation{
{"P09", "Microsoft.Resources/deployments/write", cluster.Parent.String()},
}, caller, tokenErr, identityErr)
return report, report.Err()
}
| Azure Functions | Stable |
| Azure Kubernetes Service (AKS) | Beta |
| Azure AI | Beta |
| [Microsoft Foundry on existing AKS](../../cli/azd/extensions/azure.ai.projects/README.md#existing-aks-hosting) (default or supplied supporting resources, read-only preflight) | In development (infrastructure enabled by default; Agents init/adoption disabled by default) |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI max review requested due to automatic review settings November 5, 2026 14:00

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.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI max review requested due to automatic review settings November 5, 2026 14:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

@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/10828/azure-ai-agents.zip"
  • Version: 1.0.0-pr.10828.7042254
  • Merge commit: b94dc60

This branch has not been deployed

No deployments
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.

2 participants