Skip to content

azd ai agent init -m <azure.yaml> skips interactive environment setup (subscription, Foundry project, model) #8922

Description

@therealjohn

Summary

Since PR #8885 (feat: adopt unified azure.yaml in azd ai agent init -m), running azd ai agent init -m <azure.yaml> (pointing -m at a unified Foundry azure.yaml) no longer runs the interactive environment setup steps -- selecting a subscription, selecting/creating a Foundry project, model configuration, and deploy-mode selection. The command stages/adopts the sample's azure.yaml, scaffolds the project, prints next steps, and returns without any Azure context prompting.

Pointing -m at an agent manifest (top-level template:) still runs the full interactive flow. Only the new unified azure.yaml adoption path is affected.

Repro

  1. Have a unified Foundry azure.yaml (a manifest whose services: declare a Foundry host such as azure.ai.agent / azure.ai.project).
  2. Run azd ai agent init -m <path-or-url-to-azure.yaml> in an interactive terminal.

Expected: after adopting the manifest, azd prompts for subscription, Foundry project (existing vs new), model configuration, etc., the same way it does when -m points at an agent manifest.

Actual: azd adopts the azure.yaml, prints next steps, and exits. No subscription / Foundry project / model prompts appear.

Root cause

PR #8885 added an early-return branch to the init command's RunE. When the -m pointer is detected as a unified Foundry azure.yaml (via looksLikeFoundryAzureYaml), it calls runInitFromAzureYaml and returns immediately:

  • cli/azd/extensions/azure.ai.agents/internal/cmd/init.go (routing/early return, around lines 1212-1222)

runInitFromAzureYaml only stages the template, scaffolds the project (scaffoldProject -> azd init -t), stamps infra.provider: microsoft.foundry, and prints next steps:

  • cli/azd/extensions/azure.ai.agents/internal/cmd/init_adopt.go (runInitFromAzureYaml, lines 163-216)

It never invokes InitAction.Run / runInitFromManifest, which is where the interactive Azure setup lives for the agent-manifest path:

  • subscription selection via ensureSubscription
  • Foundry project selection via selectFoundryProject
  • model configuration via configureModelChoice
  • deploy-mode selection via promptDeployMode

(see InitAction.Run around lines 1550-1719 and configureModelChoice at 1973+ in cli/azd/extensions/azure.ai.agents/internal/cmd/init.go)

Because the adoption path short-circuits before any of that runs, none of the environment setup prompts happen.

Suggested fix

After adopting the unified azure.yaml, the adoption path should still run the interactive environment setup (subscription, Foundry project selection/creation, model configuration) so the user ends up with a provision-ready environment, matching the agent-manifest flow. This likely means invoking the shared Azure-context / InitAction setup after scaffoldProject instead of returning early.

Environment

Metadata

Metadata

Assignees

Labels

area/environmentEnvironment management, .env filesarea/uxUX, prompts, output formattingbugSomething isn't workingext-agentsazure.ai.agents extensionregressionBroke something that worked before

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions