Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 5 of 39
❮Prev Next❯

CI/CD for Foundry Projects

Module 1: Plan & Manage ⏱ 9 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    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 needed

    Exam 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.

    Azure portal: CI/CD for a Foundry project with an evaluation gate Set up a federated credential and a pipeline with an evaluation gate.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    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
    1. The pipeline needs an identity in Azure, but no secret. Search for Managed Identities and open the deployment identity.
    2. Type managed identities in the search bar and pick Managed Identities under Services.
    3. Open Settings ➜ Federated credentials and select + Add Credential.
    4. 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.
    5. Give it only what the pipeline does: Contributor on the resource group for Bicep, Foundry User on the Foundry resource for agents and evaluations.
    6. 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.
    7. 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.

    😟 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
    🛠️ Solved with: CI/CD for Foundry

    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

    1. Create a user-assigned managed identity (or app registration).
    2. Add a federated credential: issuer https://token.actions.githubusercontent.com, subject such as repo:contoso/agents:environment:prod.
    3. 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.
    4. In the workflow, grant id-token: write and use azure/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

    1. Pull request: validate Bicep (az deployment group what-if), run unit tests and a small evaluation.
    2. Merge to main: deploy to dev, run the full evaluation, publish an agent version.
    3. Gate: evaluators score the run. Under the threshold, the pipeline stops and prod is untouched.
    4. Promote to test, then prod through protected environments that need an approver.
    5. 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

    Banking

    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.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    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.

    Question 1

    Question 1 of 5

    A GitHub Actions workflow must deploy to Azure without storing a client secret. What should you configure?

    Question 2

    Question 2 of 5

    A pipeline must stop a release when a prompt change lowers answer groundedness. What should you add?

    Question 3

    Question 3 of 5

    A team keeps Foundry resources, projects and deployments in source control and wants identical environments for dev, test and prod with different capacity.

    Which approach meets the requirement?

    Question 4

    Question 4 of 5

    What should a federated credential for the production deployment job be tied to?

    Question 5

    Question 5 of 5

    How should a tested agent change reach production?

    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. 1.What does a federated credential trust?Show

      A specific repository, branch or environment of GitHub or Azure DevOps.

    2. 2.What does an evaluation gate do?Show

      Fails the pipeline when scores fall below the threshold.

    3. 3.Which language describes Foundry infrastructure as code?Show

      Bicep.

    4. 4.Should the same definition be promoted or rebuilt for prod?Show

      Promoted.

    5. 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

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.