R-03 Foundry & Azure
Deploy a Foundry agent with azd: eject the Bicep before production

The Foundry extension microsoft.foundry for the Azure Developer CLI (azd) has been generally available as version 1.0 since November 5, 2026. It adds agent setup and local testing to azd, which already handles provisioning and deployment. That takes a Foundry agent from an empty folder to a deployment in a handful of commands. It is convenient. It is not platform operations. Once the agent goes to production, the infrastructure should live as code in your repo and not in the head of an extension.
What you need first
According to Microsoft you need:
- Azure Developer CLI version 1.37.0 or later
- uv
- Python 3.13 or newer
- an Azure subscription, Foundry permissions and model quota in your chosen region
Provisioned resources and model usage cost money. That includes demos, so clean up.
From empty folder to running agent
The flow from the Microsoft post, slightly shortened:
azd auth login
azd ext install microsoft.foundry
azd ai agent init \
--template https://github.com/microsoft-foundry/foundry-samples/blob/main/samples/python/hosted-agents/agent-framework/responses/01-basic/azure.yaml \
--deploy-mode code \
--src .
azd provision
azd ai agent run
azd ai agent invoke --local "Write a haiku about deploying cloud applications."
azd deploy
azd ai agent invoke "Write a haiku about deploying cloud applications."
azd ai agent monitor --follow
azd ai agent doctor
What happens here? azd ai agent init pulls the Python sample built on Agent Framework and writes the azure.yaml. azd provision creates the resources declared there, including missing model deployments in a reused project. azd ai agent run starts the agent locally and opens Agent Inspector. azd deploy builds remotely, so you need no local container build. azd ai agent monitor --follow streams logs, and azd ai agent doctor looks for setup and permission problems.
What the azure.yaml contains
The configuration sits next to your code and therefore goes through your review. Two hosts matter: azure.ai.project declares the Foundry project including model deployments, and azure.ai.agent declares the agent with source folder, runtime and compute. In the Microsoft sample that is python_3_13 and 0.5 CPU with 1 Gi of memory.
Evaluation and pipeline
Evaluations come as a separate extension. After that you continue with azd ai eval init and azd ai eval run start, in the example with an evaluation called quality:
azd ext install azure.ai.evaluations
azd ai eval init --name quality
azd ai eval run start --eval quality
azd pipeline config
azd pipeline config sets up GitHub Actions or Azure DevOps. For cleanup there is azd down. Careful: with a reused project, the project and the hosted agent stay in place. Only for a newly created demo project does the whole resource group go away.
Watch out for old tutorials
Before the 1.0 bundle, the agents extension was still in beta. Microsoft lists two changes for beta.22: the singular toolbox was replaced by a toolboxes list (azd 1.37.0 required), and the eval commands moved from azd ai agent eval to azd ai eval. If you replay a tutorial from before October, the syntax may no longer fit.
Why azd up is not platform operations
The default of azd ai agent init is bicep-less. No infra/ folder appears. azd synthesizes the infrastructure from the services in your azure.yaml at provision time. That is a good start, because you maintain no Bicep files at first.
For production it is a problem. In your pull request you only see the azure.yaml. What resources, network and roles appear underneath is decided by the extension. This is my assessment, not a Microsoft statement: if you go to production this way, your platform is not in review.
How to eject
The Learn reference for azure.yaml describes it like this:
azd ai agent init --infra # bring Bicep into your repo
azd ai agent init --infra=bicep # the same, explicitly
azd ai agent init --infra=terraform # Terraform, sets infra.provider: terraform
Afterwards the azure.yaml contains an infra section, per the Learn reference for example like this:
infra:
provider: bicep
path: ./infra
If infra is present, azd uses those files instead of synthesizing. The Learn page on CLI infrastructure (last updated October 29, 2026) lists for a new project: resource group, AI Services account, Foundry project, model deployments, an Azure Container Registry (only when the agent configuration needs a registry, source-code deployment does not) and system-assigned managed identities on the account and the project. For Bicep, infra/ holds main.bicep, main.parameters.json, abbreviations.json and a modules/ folder. Terraform writes .tf files and main.tfvars.json instead. If the project already has infrastructure, the Foundry infrastructure gets its own layer under infra/foundry/.
Now the practical point. Microsoft states verbatim that the current templates do not automatically provision Application Insights, a Log Analytics workspace, Azure AI Search, a storage account or a Bing grounding resource. So you have to add monitoring yourself, or you go to production without telemetry. That belongs in your ejected IaC.
Three catches. First: the docs name ejecting as an option “later”, but whether that behaves cleanly on an already deployed project is not stated there. So do it right at init, not shortly before go-live. Second: check how agent versions and Terraform state fit together. azd deploy creates the agent version, and the infrastructure docs do not say whether Terraform tracks it in its state. Third: per the docs, the Terraform variant currently does not support network: configuration on the service. If you need network isolation, check that before you decide on Terraform.
What you own afterwards
Once the files are in your repo, you can do what platform teams are for:
- Review: infrastructure changes go through pull requests, not through a command on a laptop.
- Policies: check the templates against your Azure Policy assignments before the pipeline runs.
- Network: according to Microsoft, the templates also configure subnets when the project declares network isolation. Check which fields apply in the
azure.yamlagainst the current reference before you rely on them. For comparison, a community example with its own template enables public network access and leaves the network ACL on Allow. That is not azd output, but it shows how open demo defaults can be. - Identities: if you work against an existing project with
--project-id, check beforehand which role assignments the tooling sets itself and which you have to set. The matrix is in the Microsoft reference on hosted agent permissions. - Naming and monitoring:
abbreviations.jsonand the parameters inmain.parameters.jsoncontrol names and variables. Adapt them to your naming scheme before resources exist. You add Application Insights and Log Analytics yourself.
For more on Bicep structure, see the related article on maintainable platforms.
Verdict
The GA is real progress: an agent in a few commands, remote build, pipeline included. But azd up is a starting gun, not an operating concept. Pull the IaC into your own repo before it sees production.
Microsoft itself says you need not maintain files unless you eject. That is true and it is the core of the problem. And the beta phase showed that syntax can change, see toolboxes. If all you have in review is the azure.yaml, you are trusting blindly.
Espresso moment: A fully automatic machine serves coffee in seconds. How the brew group is set, you only decide once you open the machine up.
Your takeaways
microsoft.foundryis available as version 1.0 since November 5, 2026. Prerequisites: azd 1.37.0+, uv, Python 3.13+.- The path:
azd ai agent init,azd provision,azd ai agent run,azd deploy(remote build). - The default is bicep-less. Production needs ejected IaC via
azd ai agent init --infra,--infra=bicepor--infra=terraform. - With your own IaC you own review, policies, network, identities, naming and monitoring.
- Check old tutorials:
toolboxis nowtoolboxes, and evaluations run throughazd ai eval.
What is your approach: eject on day one, or only when the auditor asks? Tell me on LinkedIn.
