CI/CD for Foundry Projects
30-second answer
Keep the agent definition, prompts, evaluation set and Bicep in Git. A pipeline (GitHub Actions or Azure DevOps) signs in with workload identity federation (an OIDC federated credential on a managed identity or app registration), so no secret is stored. It deploys the infrastructure with Bicep to a dev project, runs an evaluation on a fixed test set as a gate, and only then promotes the same definition to test and prod projects, each with its own RBAC and approvals. Prod secrets don't exist; access is by role.
Simulate it » No Azure account neededExam objective: 1.2.4 Integrate Foundry projects with CI/CD pipelines. (Skills measured as of April 16, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
The pipeline needs an identity in Azure, but no secret. Search for <strong>Managed Identities</strong> and open the deployment identity.
👆 Click the glowing item in the portal to continue
Read the steps as text
- The pipeline needs an identity in Azure, but no secret. Search for Managed Identities and open the deployment identity.
- Type managed identities in the search bar and pick Managed Identities under Services.
- Open Settings ➜ Federated credentials and select + Add Credential.
- Workload identity federation: GitHub signs a token for the prod environment of this repo, and Entra ID trusts it. No client secret to leak or rotate.
- Give it only what the pipeline does: Contributor on the resource group for Bicep, Foundry User on the Foundry resource for agents and evaluations.
- The workflow: sign in with OIDC, deploy Bicep, create a new agent version, run the evaluation gate, then publish. The same file works for dev and test with a different environment.
- Pipeline runs show up in Evaluations. Run ci-412 fell below the thresholds, so the workflow stopped and v3 stayed live.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
CI/CD with an evaluation gate
The agent definition, prompts and Bicep live in Git. The pipeline signs in with workload identity federation (no secret), runs an evaluation on a test set, and only then promotes from dev to test to prod projects.
🤔 What happens if…
Read this tour as text
- Pick the right model or tool. A router in your app sends each job to the cheapest thing that does it well: a reasoning model for multistep problems, a small language model for high-volume labelling, a multimodal model for photos, and a Foundry Tool such as Content Understanding for invoices.
- Where an agent gets its facts. Curated company content lives in a Foundry IQ knowledge base on Azure AI Search. Files a user drops into the chat go to file search. What the agent learns about the user across sessions goes to memory (user profile, chat summary).
- Resource, projects and deployment types. One Foundry resource holds deployments, networking and keys. Projects inside it isolate teams. Global deployments may process anywhere, Data Zone stays in the EU or US zone, Standard stays in one region. The standard agent setup keeps threads, files and vectors in your own Cosmos DB, Storage and AI Search.
- Configure deployments and agent versions. A deployment pins a model, a model version, a deployment type, capacity (TPM) and a guardrail. An agent gets a new version every time you change it; the endpoint serves the version you choose, so you can roll back.
- CI/CD with an evaluation gate. The agent definition, prompts and Bicep live in Git. The pipeline signs in with workload identity federation (no secret), runs an evaluation on a test set, and only then promotes from dev to test to prod projects.
- Quotas, 429s, spillover and budgets. Quota is tokens per minute per model, per region, per deployment type. Each deployment gets a slice; RPM comes with it. Go over and you get HTTP 429 with a retry-after header. Provisioned throughput can spill over to a standard deployment, and a cost control can stop a project at its token budget.
- Monitor models, agents and search. Azure Monitor metrics show requests, tokens, latency and errors. Application Insights holds traces, and continuous evaluation scores a sample of live answers for groundedness and safety. For Azure AI Search, watch indexer runs, document counts, search latency and throttled queries.
- Keyless and private. The app uses a managed identity and Microsoft Entra ID tokens, with the Foundry User role on the resource. Local (key) auth is turned off. Public network access is disabled and a private endpoint in your VNet is the only way in.
- Guardrails at four intervention points. A guardrail is a set of controls: a risk (hate, violence, prompt attacks, indirect attacks, protected material, PII), the intervention point (user input, tool call, tool response, output) and the action (annotate, or annotate and block).
- Evaluate, red team and trace. Evaluators score answers: groundedness, relevance, coherence, safety, and agent ones like tool call accuracy and task adherence. The AI red teaming agent attacks before launch. Traces in Application Insights record every model call, tool call and approval for audit.
- Govern what the agent may do. Give the agent only the tools it needs (allowed tools), make risky tools require approval from a human, let the tool call guardrail check what it sends, and limit where a hosted agent can connect with network egress controls.
A prompt change hurt groundedness last month and nobody noticed until customers complained. Read the pipeline, see what happens without a gate, then add the gate.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
Prompts are edited in the portal on Friday evening and break production on Saturday.
😊 THE SOLUTION
Keep agents and infrastructure in Git and ship them through a pipeline with an evaluation gate.
- A client secret in the pipeline✓ Workload identity federation (OIDC)
- Untracked prompt edits✓ Agent definitions in Git
- Quality checked by hand✓ An evaluation gate before publish
Start with a question
Who checks that a prompt tweak didn't make the agent worse?
On Friday, someone shortened the support agent’s instructions to make replies “snappier”. It passed a quick look. By Monday, answers were quoting policy that didn’t exist. Nobody was careless. There was just no step that measured quality before the change reached customers.
A pipeline is that step. It runs the same checks every time, and nobody has to remember.
Explain it like I’m 10
The technical explanation
What goes into Git
repo/
infra/main.bicep Foundry resource, projects, deployments, role assignments
infra/dev.bicepparam per-environment values (capacity, names)
agents/support-agent.yaml instructions, model, tools
evals/support-cases.jsonl test set with expected answers
.github/workflows/deploy.yml
Review changes by pull request. A prompt edit is a code change.
Sign in without a secret
- Create a user-assigned managed identity (or app registration).
- Add a federated credential: issuer
https://token.actions.githubusercontent.com, subject such asrepo:contoso/agents:environment:prod. - Give that identity the roles it needs on each environment’s scope, for example Contributor on the dev resource group and a narrower role in prod.
- In the workflow, grant
id-token: writeand useazure/login.
permissions: { id-token: write, contents: read }
jobs:
release:
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4
- uses: azure/login@v2
with: { client-id: ${{ vars.AZURE_CLIENT_ID }}, tenant-id: ${{ vars.AZURE_TENANT_ID }}, subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} }
- run: az deployment group create -g rg-agents-dev -f infra/main.bicep -p infra/dev.bicepparam
- run: python run_evals.py --dataset evals/support-cases.jsonl --min-groundedness 4.0
The stages
- Pull request: validate Bicep (
az deployment group what-if), run unit tests and a small evaluation. - Merge to main: deploy to dev, run the full evaluation, publish an agent version.
- Gate: evaluators score the run. Under the threshold, the pipeline stops and prod is untouched.
- Promote to test, then prod through protected environments that need an approver.
- After release: continuous evaluation and monitoring keep watching.
Use separate projects or resources per environment, each with its own RBAC and networking, and promote the same definition with different parameters.
Architect level Why the subject claim in the federated credential matters
The subject says which workflow runs may sign in: a repo, a branch, a tag or an environment. A loose subject, such as any branch in the repo, lets a pull request from a fork-like context ask for production access. Tie prod’s credential to the protected prod environment, so the approval rule applies before Azure issues a token.
Real-world business scenario
Fabrikam Bank (fictional)
- The problem
- Prompt edits went straight to production, a service principal secret had been pasted into a wiki, and a quality drop took three days to notice.
- What they used
- Bicep and agent definitions in GitHub, a federated credential per environment, an evaluation step with groundedness and relevance thresholds, and a protected prod environment that needed an approver.
- Why that choice
- Federation removed the secret, the gate measured every change, and the approval kept a human in front of prod.
- The result
- The next weak prompt change was blocked in the pull request, and releases became routine.
When to use it and when not to
✓ Use it when…
- More than one person changes prompts, tools or infrastructure.
- You must show who changed what, and when.
- Quality has to be measured before customers see a change.
✕ Think twice when…
- You keep a long-lived secret in the pipeline when federation works.
- You rebuild prod by hand instead of promoting the tested definition.
- Your evaluation set is five questions long and never changes.
↔ Alternatives to consider
- Azure Developer CLI (azd) templates for a quick start on a single environment.
- Azure DevOps pipelines with a workload identity service connection.
- Manual promotion in the portal for a prototype that has no users yet.
Test yourself with exercises
5 original practice questions in the AI-103 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner Why does the pipeline use workload identity federation instead of a client secret?
Model answer
A secret can leak, expire and needs rotating. With federation, GitHub proves who the job is with a short-lived OIDC token, and Azure trusts that because I set up a federated credential for that repo and branch. There's nothing stored to steal.
Intermediate What do you version-control for an agent project?
Model answer
The Bicep for the resource, projects and deployments, the agent definition with its instructions and tool list, the evaluation dataset and thresholds, and the pipeline file. Anything that changes behaviour belongs in Git, so a review shows exactly what changed.
Experienced developer How do you stop a prompt change that makes answers worse?
Model answer
I add an evaluation step to the pipeline that runs a fixed test set through evaluators such as groundedness and relevance, and fails the job under a threshold. Promotion to test and prod depends on that step passing, and prod also needs a manual approval from a protected environment.
Scenario Dev, test and prod must be isolated, but the same definition must run in each. How?
Model answer
One Bicep template with parameters per environment, deployed into separate Foundry projects or resources with their own RBAC and networking. The agent definition is the same file. Only parameters such as model capacity, endpoints and connection names differ.
Quick revision
Key points
- Agents, prompts, evaluation data and Bicep live in Git and flow through pull requests.
- Federated credentials let a pipeline sign in without a stored secret.
- An evaluation step is a release gate. Failing scores stop promotion.
- Promote the same tested definition dev, test, prod, with approvals and separate RBAC.
- Use least-privilege roles for the pipeline identity at each environment.
Important terminology
- Workload identity federation
- A way for a pipeline to get an Azure token by proving its identity with an OIDC token from GitHub or Azure DevOps, so no client secret is stored.
- Federated credential
- The trust setting on a managed identity or app registration that says which repository, branch or environment may sign in.
- Evaluation gate
- A pipeline step that runs evaluators on a test set and fails the build if scores fall below a threshold.
- Bicep
- Azure's declarative language for infrastructure. It describes Foundry resources, projects, deployments and role assignments as code.
- Environment promotion
- Moving the same tested definition from dev to test to prod, with approvals between stages, instead of rebuilding it each time.
- Infrastructure as code
- Describing cloud resources in files kept in source control, so environments can be recreated and reviewed like software.
Common mistakes
- Storing a client secret in repository secrets when federation is available.
- Promoting by rebuilding in prod instead of promoting the tested definition.
- Giving the pipeline Owner on the whole subscription.
Exam tips
- "No secrets stored in the pipeline" = workload identity federation.
- "Block a release that lowers quality" = an evaluation gate.
- "Repeatable environments" = Bicep (infrastructure as code).
Five quick revision questions
-
1.What does a federated credential trust?Show
A specific repository, branch or environment of GitHub or Azure DevOps.
-
2.What does an evaluation gate do?Show
Fails the pipeline when scores fall below the threshold.
-
3.Which language describes Foundry infrastructure as code?Show
Bicep.
-
4.Should the same definition be promoted or rebuilt for prod?Show
Promoted.
-
5.Which GitHub permission lets a job request an OIDC token?Show
id-token write.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Quotas, Rate Limits, Scaling and Cost
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.