[azure.ai.agents] Align env placeholder resolution across deploy flows
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
- [ ] Make sure you've installed the latest version using [instructions](https://github.com/Azure/azure-dev?tab=readme-ov-file#installupgrade-azure-developer-cli)
**Output from `azd version`**
To be provided.
**Describe the bug**
Environment-variable placeholders in `azure.yaml` are resolved differently depending on how a hosted agent is deployed.
When deployment is initiated from the Microsoft Foundry VS Code extension, placeholders such as `${MY_VALUE}` can be resolved from the project-level `.env` file.
When the same project is deployed with `azd deploy`, azd resolves values from the selected azd environment but does not load the project-level `.env` file. The resulting hosted-agent environment can therefore differ even though both flows use the same `azure.yaml`.
This difference is difficult for users to discover and can cause a deployment to succeed through one client but fail or behave differently through the other.
**To Reproduce**
1. Create a hosted-agent project with an `azure.yaml`.
2. Add an environment-variable value containing a placeholder:
```yaml
environment:
API_ENDPOINT: ${API_ENDPOINT}
```
3. Define `API_ENDPOINT` in the project-level `.env` file, but not in the selected azd environment.
4. Deploy the project through the Microsoft Foundry VS Code extension.
5. Observe that the placeholder is resolved.
6. Deploy the same project with `azd deploy`.
7. Observe that the placeholder is not resolved from the project `.env` file.
**Expected behavior**
Deployments using the same `azure.yaml` should follow a consistent, documented environment-variable resolution contract regardless of whether deployment starts from VS Code or the CLI.
Preferably, both flows should use the same resolution sources and precedence rules.
If project-level `.env` resolution is intentionally specific to the VS Code extension, azd and the extension should clearly expose that difference through validation, deployment logs, and documentation. Unresolved placeholders should not be silently deployed.
**Environment**
- Hosted Foundry agent
- Microsoft Foundry VS Code extension
- Azure Developer CLI
- Project containing `azure.yaml` and a project-level `.env`
Contributor guide
Research direction
Start with the azure.yaml and project-level .env from the reproduction, then run the same hosted-agent deployment through the Microsoft Foundry VS Code extension and azd deploy. Compare how each flow resolves ${API_ENDPOINT} and review the azd deploy entry point. Done means both flows share documented resolution and precedence rules, or unresolved placeholders are clearly surfaced through validation or logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, go, vscode
- Domain
- cli, cloud, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100