How promptfoo runs in Azure Pipelines and where it fits
Your team wants LLM evals or red team checks to gate changes that reach production, and Azure DevOps is where those changes are already reviewed and built. The supported method is the Azure Pipelines example in promptfoo's documentation. It installs and runs the promptfoo CLI as a normal script step, writes results to promptfoo-results.junit.xml, and publishes that file with the PublishTestResults@2 task using the JUnit format. Azure DevOps does not offer a native promptfoo task or marketplace extension in that documented path, so plan on a YAML pipeline that you own and maintain. Confirm the current example against the promptfoo Azure Pipelines integration page before you copy it, because the step syntax and output flags are the parts most likely to change.
promptfoo runs on the build agent itself. Evals execute on the machine the pipeline job lands on, and the CLI calls each model provider directly over the network. Nothing is sent to a promptfoo-hosted service for a basic eval run, so the agent needs outbound access to every provider endpoint in your configuration and must have the required Node.js version installed. Provider API keys are the sensitive part of this design. They should be stored as secret pipeline variables, mapped into the job environment only for the steps that need them, and never written into promptfooconfig.yaml or the repository. Ask your security team to confirm which agent pool and identity the job uses, who can edit the variable group, and whether the agent's logs or uploaded artifacts could echo a key.
Decide early where this pipeline sits in your control set. Because the pipeline is the only place provider keys need to live, its variable permissions, branch policies and approval rules become the access model for your LLM spend and data. Pull request validation, scheduled red team runs and release gates may need different variables, agents or permissions, so define those boundaries before writing the first YAML file. Checks that depend on a model-graded judge can also be flaky, so decide in advance what failure threshold blocks a merge.
What you need before the first pipeline run
Five things must be in place before the Azure Pipelines job can run promptfoo and publish results. Each card below covers one of them, and most failed first runs trace back to one of these gaps rather than to the YAML itself.
Node.js 22.22.0 or newer
The current promptfoo npm release, 0.124.1, requires Node.js 22.22.0 or newer. Check the Node version on the agent image before writing the pipeline, because Microsoft-hosted and self-hosted images differ and can be updated on their own schedule. Confirm the agent's Node version with node --version in a test job, and compare it against the release notes for the promptfoo version you pin. If the image is older, add a Node install step rather than assuming the agent has the right runtime.
Azure DevOps project and agent
You need an Azure DevOps project with a pipeline definition and an agent pool that can run Node.js jobs. A hosted agent is the simplest start, but a self-hosted agent is often required when evals must reach a private model endpoint. Decide the pool before the first run, since changing it later changes where your provider traffic originates and which network rules apply.
Outbound access to model providers
Promptfoo runs locally on the agent and calls the model provider directly, so the agent must reach each provider's API endpoint. For a private or self-hosted agent, confirm outbound firewall, proxy and DNS rules for every provider in your config before the first run. Ask your network team to test from the agent itself, not from a developer laptop, because the two networks often differ.
Provider accounts and API keys
Each model provider the config calls needs an account, a key with a spend limit, and a named owner. Create dedicated keys for CI rather than reusing personal keys, so revocation and cost reports stay separate from developer activity. Plan for rotation, because keys stored as pipeline variables must be updated in every pipeline that uses them when a key changes.
A promptfoo config in the repository
The pipeline calls promptfoo against a configuration file, typically promptfooconfig.yaml, committed to the repository alongside the prompts and test data it references. Commit it before the first run so the pipeline is reproducible and reviewers can see changes to prompts, providers and assertions in the same pull request. Confirm that the file references only environment variables for secrets, never literal keys.
Configure the azure-pipelines.yml step by step
This sequence takes a pipeline from stored provider keys to a working promptfoo eval that reports pass and fail results in the Tests tab of each run. Each step ends with a check you can perform in Azure DevOps before moving on.
Store provider keys as secret pipeline variables
Create each provider API key as a pipeline variable in Azure DevOps and mark it as secret, so the value is masked in logs and not stored in the YAML file. Keep the key names identical to the environment variables promptfoo reads for each provider, such as the variable your model provider documents. Your pipeline owner or project administrator usually performs this step. You know it is done when the variable appears in the pipeline's variable list with a lock icon and the value cannot be viewed after saving, and when a test echo of the variable in a throwaway job prints asterisks instead of the key.
Pin the Node.js runtime and promptfoo version
Select an agent image or add a Node.js tool installer step that meets the runtime requirement for the promptfoo release you choose. The current npm release requires Node.js 22.22.0 or newer, so confirm that version on the agent. Then install promptfoo with a fixed version number in the npm install command rather than a floating tag, so that a new release does not change results between runs. You know it is done when the first job prints the Node and promptfoo versions and both match what you pinned.
Map secrets into the eval step
In the step that runs the eval, pass the secret variables into the process environment explicitly, using the env block of the script task. Secrets are not exposed to scripts automatically, so a missing mapping causes provider calls to fail with authentication errors instead of a clear config message. Confirm that the eval config reads keys only from the environment and contains no literal values. You know it is done when a dry run against one provider authenticates successfully and the key does not appear anywhere in the job log.
Run the eval with JUnit output
Run the promptfoo eval command with its JUnit output option so it writes promptfoo-results.junit.xml to the agent workspace. Set the step to continue on failing assertions so the results file is still created, and handle the pass or fail decision in a later step or with a pass-rate threshold. Confirm the exact CLI flags against the Azure Pipelines integration page for the release you pinned. You know it is done when the file exists in the workspace and contains one test case per eval row.
Publish results with PublishTestResults
Add a PublishTestResults@2 task that points at promptfoo-results.junit.xml and sets the test result format to JUnit. Use a condition that runs the task even when the eval step failed, so that failed assertions appear in the report instead of disappearing with the job. Give the test run a title that identifies the branch or prompt version. You know it is done when the pipeline run shows a Tests tab with the pass and fail counts, and a failed assertion links to its message.
Check the run and the masked output
Open a completed run and compare the Tests tab with the eval summary printed in the log. Search the full log for the provider key value and for any request header echo, since debug output can include them. If a secret appears, remove the verbose flag and rotate the key. You know it is done when counts match between the log and the Tests tab and no secret value is visible in the log or the published artifacts.
Confirm the pipeline gates merges
Decide whether a failed assertion should fail the job, and set the eval step behavior to match that decision, using the pass-rate threshold settings described in the failing-builds guidance for promptfoo. Then trigger one run with a deliberately failing test on a non-protected branch. You know it is done when the job status is failed, the Tests tab still shows the failure, and a passing run leaves the job green.
Running matrix jobs across models or prompt variants
A strategy: matrix: block with one entry per provider or model lets each Azure Pipelines job run the same promptfoo configuration against a different target. Each entry sets a variable, such as a model alias, that your promptfoo config reads through an environment variable. The jobs run in parallel, and each one reports its own results, so a regression that affects only one provider shows up in that job without digging through a combined log.
- Named entries: Name each matrix entry after its model alias, because that name becomes the job label in the run view and the name reviewers scan first.
- Per-job result file: Write
promptfoo-results-$(modelAlias).junit.xmlso every job produces its own JUnit file and none overwrites another. - Scoped keys: Map only the provider key each job needs into that job's environment, so a compromised or misconfigured job exposes one key, not all of them.
- Separate spend: Each job's API calls are separate, which makes it clear which provider drives cost.
Before the first run, check that every provider entry in your config reads the model variable, or every job will silently test the same model.
Prompt variants, such as alternative system prompts or template revisions, can be matrix entries that point to different prompt files. The same model and test set then run against each candidate, which is useful when comparing prompt revisions before a merge. The result is a set of comparable pass rates, one per variant, shown as separate runs in Azure Pipelines.
- Prompt path per entry: Pass a prompt file path, such as
prompts/support-v2.txt(illustrative), through a matrix variable so the config loads the right prompt. - Variant name in the file: Include the variant name in the JUnit file, for example
promptfoo-results-$(variantName).junit.xml, so variants never overwrite each other. - Shared test cases: Keep one test file and one grader across all variants so that pass-rate differences come from the prompts.
- Readable run titles: Set
testRunTitlein the publish step to the variant name, so the Tests tab shows which prompt produced which results.
Confirm that all variants use the same test cases and grader, because otherwise a difference in pass rate may reflect changes to the test set or grading rather than the prompt itself.
A single job that runs every model and every prompt variant in one promptfoo invocation produces one results file and one exit code. This is the simplest option to gate on, since a single pass-rate threshold covers everything. The trade-off is that all targets share one agent and one run, so the job grows with the total number of targets and tests, and attribution depends on how clearly the test names are labeled.
- One file, one gate: A single
promptfoo-results.junit.xmland one exit code make the pass-rate gate easy to review and explain. - Longer job: Runtime scales with the combined number of targets and test cases, so check that the job finishes within the time limit your pipeline allows.
- Labeled test names: Make sure each test name includes the provider and prompt label, because otherwise reviewers cannot tell which target failed.
- Shared cache: One process can reuse the response cache across targets, but confirm how promptfoo's caching behaves in your version before relying on it for cost savings.
Choose the combined run when one aggregate threshold is what your team wants to enforce and the suite finishes comfortably within your job limits, and check the test output after the first run to confirm the labels are readable.
Matrix runs multiply API spend, because every entry runs its own eval. Entries that start together can also hit provider rate limits at the same moment. Rate limits and quotas apply to the account behind each key, not to the pipeline, so the pipeline design cannot raise them. Confirm the limits with each provider before you widen the matrix, and set concurrency deliberately.
- Spend multiplies: Cost grows with the number of tests, targets and any model-graded assertions, so each new matrix entry adds a full eval run to the bill.
- Grader calls count: A model-graded assertion makes extra calls per test, and a grader shared by several entries still incurs those calls in each one.
- Provider limits: Ask each provider for the requests-per-minute and token limits that apply to the keys you plan to use.
- Parallel job allocation: Check how many parallel jobs your Azure DevOps organization can run, since a wide matrix uses those slots at once.
- Concurrency cap: Set promptfoo's concurrency option inside each job, and confirm the exact setting in the promptfoo documentation for your version.
Ask your platform or finance owner for an agreed concurrency limit and a spend ceiling before adding entries, and recheck both after each new model or variant is added.
Mapping pipeline variables, config files and test results
This table traces each Azure Pipelines variable and file to the promptfoo setting or PublishTestResults input that reads it. Read it top to bottom to follow a value from the pipeline into the eval run and then into the test tab. Confirm every variable name against your promptfooconfig.yaml and your promptfoo version before the first run.
| Item | Where it is set | What reads it or where it goes |
|---|---|---|
| Provider API keys | Secret pipeline variables, mapped into the eval step's env block | Environment variables named by each provider, such as OPENAI_API_KEY. Confirm names in the provider docs. |
| Model identifiers | Pipeline variables or a matrix parameter per model | Referenced in the providers list of promptfooconfig.yaml. Confirm the environment substitution syntax for your version. |
| Pass-rate threshold | Pipeline variable, exported to the eval step if used | Read by the CLI if your version supports PROMPTFOO_PASS_RATE_THRESHOLD. Confirm before relying on it. |
| Config file | Path in the eval command, usually the repository root | Loaded by promptfoo eval. A wrong path usually fails the job before any model call is made. |
| JUnit output file | Output flag on the eval command, promptfoo-results.junit.xml in the example | Written to the agent's working directory. Confirm the output flag for your promptfoo version. |
| testResultsFormat | PublishTestResults@2 input set to JUnit | Tells the task how to parse the file so results appear in the Tests tab. |
| testResultsFiles and searchFolder | Filename or glob, with searchFolder set to the working directory | Must match the output path exactly, including subfolders. A mismatch publishes zero tests without an error. |
| testRunTitle | Input set per run, such as the model or prompt variant name | Separates matrix results in the Tests tab so each model or variant can be reviewed on its own. |
What reviewers see in the Tests tab and what stays in the log
When the pipeline publishes promptfoo-results.junit.xml with PublishTestResults@2 using the JUnit format, each promptfoo test case appears as a row in the Tests tab of the run. A passing case shows as a pass. A failing assertion shows as a failure with the assertion message attached, so reviewers see which prompt, provider or test case broke and why, without opening the console log. Confirm in a test run that your Azure DevOps organization shows the test names and failure messages you expect, because the exact layout depends on what promptfoo writes into the XML and how the task parses it.
The same run also keeps the raw material. The console log prints request and response details during the eval, and the results file, any cache folder and any uploaded artifacts can contain the full prompts, model outputs and, for red team scans, adversarial inputs that may include customer-like or sensitive text. Anyone with read access to the pipeline can open these. Before widening access, decide which of these files are published and who can see them, and run one representative job and inspect the XML, the log and the artifacts for personal data, credentials and internal system prompts. Use pipeline variables marked as secret for provider keys so they are masked in logs, and confirm that masking works for the exact key formats you use.
Reduce exposure at the source. Use synthetic or redacted test data in the configuration, keep production records out of the eval dataset, and limit what gets published to the Tests tab by choosing which results file to pass to the task. Review who holds the Build and Project reader roles and who can download pipeline artifacts, since these permissions decide whether a test file that looks harmless is visible to contractors or other teams. Agree on a retention setting for artifacts with your security owner before the first scheduled run.
Securing provider keys and pipeline access
The pipeline is only as safe as the keys it holds and the people who can change it. The cards below cover how provider keys are stored and scoped, who can run and edit the pipeline, and how the promptfoo version is fixed. Access control at the CLI level is limited, so most of it sits in Azure DevOps and in your provider accounts.
Mark provider keys as secret variables
Store each provider key, such as the OpenAI or Anthropic key your config reads, as a secret pipeline variable rather than a plain value in azure-pipelines.yml or promptfooconfig.yaml. Secret variables are masked in logs, but only if the step does not print them, so avoid echo or debug flags that dump the environment. Check the build log after the first run to confirm the key does not appear. Never commit a key to the repository, even temporarily, because the value stays in git history.
Restrict variable groups and environments
If keys live in a variable group, limit its pipeline permissions to the pipelines that need them, and do not grant access to all pipelines by default. Use Azure DevOps approvals and checks on environments when a run deploys or touches production-like data. Review which pipelines hold each group whenever a new repository is added. Ask your Azure DevOps administrator to confirm who can view and edit the group, since those permissions are set in Azure DevOps, not in promptfoo.
Protect the pipeline definition
Anyone who can change azure-pipelines.yml can make the job print a key, send data to another endpoint or skip the gate. Enable branch policies on protected branches that require review before merge, and restrict who can push directly to them. Consider whether pipeline runs from forks or untrusted branches should receive secret variables at all. Confirm these settings in your repository and pipeline permissions rather than assuming the defaults match your policy.
Pin the promptfoo version
Install a specific promptfoo release in the pipeline, for example with npm install -g promptfoo@ followed by the version you tested, instead of the latest tag. An unpinned install can change grading behavior or output format between runs without any code change. Upgrades then become deliberate pull requests that re-run your suite. The current npm release and its Node.js requirement are listed on the npm registry and in the GitHub releases, so check both before choosing a version.
Use a dedicated low-privilege key
Create a separate key for CI with only the model access the eval needs, and set a spend limit or budget on it in the provider console. A leaked key then has a bounded blast radius and cannot reach production workloads. Rotate it on a schedule and after staff changes, and record which pipeline owns it. Provider key scopes and budget controls differ by vendor, so confirm the options your provider offers before you design the rotation process.
Plan for missing CLI access control
The open-source promptfoo CLI has no built-in SSO, RBAC or user management, so it does not decide who may run evals or view results. Access control therefore depends on Azure DevOps permissions, provider account roles and where result files are stored. If you need team-level access control, sharing and SSO across runs, review the Enterprise options and confirm what they cover before relying on them. Document this split in your security review so auditors see where each control lives.
promptfoo pricingCommon failures in the first Azure Pipelines run
This table lists the failures teams most often hit on their first promptfoo run in Azure Pipelines, with the likely cause and fix for each. Scan the first column for the symptom you see in the job log, then follow the fix in the right column. Most first-run failures come from variables, Node.js versions and file paths rather than from promptfoo itself.
| Symptom | Likely cause | Fix |
|---|---|---|
| Provider key is empty or authentication fails | The secret pipeline variable is not defined for this branch, or the run comes from a fork or unauthorized source that cannot read secret variables | Confirm the variable exists in the pipeline settings and is mapped into the job's environment. Check your Azure DevOps settings for forked pull requests before relying on secrets in those runs |
| promptfoo command not found or exits with a Node.js version error | The agent image has an older Node.js than the release requires (npm release 0.124.1 requires Node.js 22.22.0 or newer, per the npm registry) | Add a NodeTool@0 task that installs a supported Node.js version before any npm step, then print node --version in the log to confirm |
| JUnit file not found | The output path is relative to a different working directory than the one the publish step reads, often because the eval ran in a subfolder | Write the output to $(Build.SourcesDirectory) or a fixed path, and reference the same absolute path in the publish step |
| PublishTestResults reports no test files | The glob pattern does not match promptfoo-results.junit.xml, or the eval step failed before writing the file and the publish step still ran | Set condition: always() on the publish task so it runs after failures, and confirm the searchFiles pattern matches the file name written by promptfoo |
| Eval step fails with 429 or timeout errors | Provider rate limits or long-running requests when many test cases or matrix jobs call the same API at once | Lower concurrency in the eval command, reduce matrix fan-out for the same key, and check your provider's rate limit documentation for your account tier |
| Results are green but tests were skipped | The eval ran against an empty or wrong config path, so zero assertions executed | Print the number of test cases in the log and fail the job when the count is zero |
| Cache or results from a previous run appear | The promptfoo cache directory persists between runs or the output file is reused without being rewritten | Delete the old results file before the eval step and confirm the cache location with your team before enabling any cache step |
Questions teams ask before running promptfoo in Azure Pipelines
What drives the cost of running promptfoo in Azure Pipelines?
The main costs are the time to author and maintain the pipeline YAML, the model API spend each run generates, and the agent capacity that executes the jobs. Pipeline authoring is largely one-time, but the YAML recurs as a maintenance item whenever Node.js requirements, providers or test suites change. Provider spend recurs on every run and grows with the number of test cases, the number of models in a matrix and how often the pipeline triggers. Model-graded assertions add grader calls on top of the target calls. Ask any partner to price the authoring, the first-run tuning and the ongoing upkeep separately so you can see which part is one-time.
How much does a matrix run across models multiply API spend?
Spend scales roughly with the number of matrix combinations multiplied by the size of the eval suite, plus any grader calls. Each model or prompt variant in the matrix runs the full set of test cases, so adding a model adds its full cost to every run. Illustrative example: a suite of 200 cases run against three models is three times the calls of one model, before grader overhead. To control this, keep the matrix to the variants that matter for a given branch, run the full matrix on main or on a schedule, and check the provider's current pricing directly with each provider, since promptfoo does not set model prices.
Can our own team set up promptfoo in Azure Pipelines without a partner?
Yes, if your team already runs Node.js jobs in Azure Pipelines and can manage pipeline variables. The core job installs the promptfoo package, runs the eval, writes promptfoo-results.junit.xml and publishes it with PublishTestResults@2 in JUnit format. The harder parts are choosing assertions that do not flip between runs, setting pass-rate thresholds, keeping provider keys out of logs and deciding who owns the eval suite after launch. A partner is most useful when you need those decisions made once and documented, or when the same pattern must work across several pipelines and repositories.
What do we need to provide before the work starts?
Prepare four things: provider accounts with API keys that are scoped for CI use, a sample eval suite that represents the behavior you care about, access to the Azure DevOps project and the agent pool that will run the job, and a named owner who can approve changes to prompts and test cases. If the application under test is an agent or needs internal endpoints, you also need access to those endpoints from the agent network and a test account with the permissions you want exercised. DeployOpen works within the client's own infrastructure, so these items stay under your control.
How are provider keys kept safe in Azure Pipelines?
Store each provider key as a secret pipeline variable, or in a variable group linked to Azure Key Vault if your organization already uses it, and reference it in the job environment rather than writing it into the YAML. The promptfoo Azure Pipelines integration documentation describes provider API keys stored as Azure Pipeline variables, so start from that pattern. Mark variables as secret, restrict who can edit the pipeline and the variable group, and confirm with your security team how logs, forked pull requests and agent pools are handled. Verify with your own tests that keys do not appear in console output or in the published result files.
Does the promptfoo Community edition cover running evals in CI?
The Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. Running the CLI from an Azure Pipelines job falls within those features, so a CI eval does not by itself require a paid edition. Enterprise adds team sharing, SSO, access control and priority support with SLAs at custom pricing, and On-Premise runs that functionality on your infrastructure. Confirm with promptfoo whether your planned probe volume and support needs fit the Community terms before you rely on them.
Who maintains the pipeline YAML after the first release?
Whoever owns the pipeline must maintain it, and the YAML needs review whenever promptfoo versions change, Node.js requirements move, providers are added or removed, or the matrix grows. The promptfoo npm release 0.124.1 requires Node.js 22.22.0 or newer, so pin the Node.js task version and test upgrades in a branch before changing the pipeline on main. Agree on who reviews changes to the eval suite and the pass-rate threshold, since those decide whether a merge is blocked. Ask any partner to define this ownership split in the handover documentation.
What should we check before trusting the first Azure Pipelines run?
Check that the job starts on an agent with the required Node.js version, that the eval completes and writes promptfoo-results.junit.xml, and that PublishTestResults@2 shows the cases in the Tests tab. Confirm that a deliberately failing case fails the pipeline, and that a run from a pull request cannot read secret variables in a way your policy forbids. Also verify the cost of one run against the provider dashboard, so the first real budget figure comes from measured usage rather than estimates.
How the pipeline moves keys, configs and results
The run starts when a pipeline job on an Azure agent reads provider keys from secret pipeline variables and passes them to promptfoo as environment variables. promptfoo then calls the model providers directly from the agent, which is the trust boundary to check: keys and prompts leave your agent for the provider, and nothing is routed through a promptfoo-hosted service. Each run writes promptfoo-results.junit.xml, and the PublishTestResults@2 task sends that file to Azure DevOps, where reviewers read the test tab. Confirm which secret variables are marked secret and which logs or artifacts may still contain prompts or outputs.
Keys enter the agent, requests cross to providers, and only the JUnit file is published.
How DeployOpen works on this
DeployOpen starts by agreeing in writing what the Azure Pipelines integration covers: the pipeline file, variable setup, result publishing and matrix layout. We then build and test it in your Azure DevOps organization and hand over documentation your team can run without us.
How we scope
- Agree which promptfoo eval suites and red team configs the pipeline must run, and on which branches.
- Confirm the Azure DevOps agent pools, Node.js version and network paths to each model provider.
- Record which provider keys become secret pipeline variables, who may edit them and how they rotate.
How we build
- Write the azure-pipelines.yml with a promptfoo step, a PublishTestResults@2 step reading the JUnit output.
- Set up matrix runs across the models or prompt variants named in the written scope.
- Test failing and passing runs so the pipeline result matches the promptfoo exit code and the agreed gate.
How we hand over
- Deliver the pipeline file, variable inventory and a short runbook with the steps to add a model or variant.
- Walk your platform and security engineers through where secrets live and where JUnit results appear.
- Document known limits of the self-hosted or local setup so your team can plan upgrades and changes.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Ask for the support terms, response expectations and upgrade handling in writing before signing.

