Service accounts and API keys for promptfoo in CI/CD

How teams give CI pipelines scoped access to promptfoo Enterprise with service accounts, store keys in a secrets manager and rotate them, and what to confirm before rollout.

On this page

How CI pipelines authenticate to promptfoo Enterprise with service accounts

A pipeline that runs scheduled or gated red team scans against a promptfoo Enterprise or On-Prem instance needs an identity of its own, because a scan should not depend on a person's login that can expire, leave the company or change roles. The Community CLI is simpler. It runs locally, talks directly to the model under test, and needs only the model provider credentials that the evals use. Enterprise adds a server with teams-based access control, SSO, custom roles and permissions, so the pipeline identity has to fit into that model and be limited to the teams and targets it actually scans.

The public material supplied for this page does not document how service accounts or API keys work in promptfoo Enterprise. It does not say who can create them, whether keys are scoped to teams or roles, how they are passed to the CLI, or how they are revoked and rotated. Treat those as open questions to put to the vendor before you design the pipeline. Ask whether a non-human identity is supported, whether it is bound to a team or an organization, what role it receives and whether its permissions can be narrowed to a single team's targets. Ask also whether the credential is shown once, how long it lives, and whether an administrator can revoke it without touching other pipelines.

Until those answers are confirmed, plan for the parts that do not depend on the vendor's answers. Decide which team owns each pipeline identity, keep one identity per pipeline rather than one shared key for everything, and confirm that the secrets manager your organization already runs can hold and inject the credential into the CI job. Ask the vendor for the rotation procedure and test it in a non-production instance first. Your organization's own access review should be able to show which pipeline identities exist, what each one can scan and when each credential was last changed.

Where credentials sit between the CI runner, secrets manager and promptfoo Enterprise

The diagram starts at the CI job, which pulls a service account credential from the secrets manager when the job begins. The CLI then presents that credential to the promptfoo Enterprise or On-Prem platform, which checks the team scope before anything else happens. The CLI then sends traffic to the target application or model provider directly, so the platform never sits in that path. Check that the credential never appears in logs or job artifacts, and that the team scope matches the target the pipeline is allowed to test.

Illustrative flow showing where the credential lives and which trust boundaries it crosses.

Which credential model fits each pipeline

This table compares four credential models a team can consider for CI pipelines calling promptfoo, covering what each one authenticates, who owns it, what it can reach and when it fits. Read each row against your own pipeline inventory, and treat any capability marked for confirmation as an open question for the vendor until it is verified in writing.

Credential modelWhat it authenticates and who owns itWhat it can reachWhen it fits
Model provider keys only, Community CLIProvider API keys for the models under test, held by the pipeline owner; promptfoo itself does not require a promptfoo account for local runsThe model provider endpoints named in the config, with no shared promptfoo team workspaceSmall, single-owner evals where results stay in the pipeline artifacts and no team sharing is needed
One Enterprise service account per pipelineA dedicated non-human identity per pipeline, owned by the platform or security team; exact creation flow to confirm with the vendorWhatever team and resources the account is granted, ideally limited to one pipeline's targetsPipelines that must push results to Enterprise and need a clear audit trail per job
One service account per product teamA shared identity owned by the product team lead, used by several jobs in that team's repositoriesAll targets and results within that team's scope, so a leaked key exposes more than one pipelineTeams with several related pipelines and few compromise-sensitive targets; confirm how scopes and roles map to teams
On-Prem instance with a runner inside the networkIdentity handled by the On-Prem deployment's identity service (FusionAuth), owned by your platform team; runner credentials to confirm with the vendorInternal targets and data inside your network, with traffic leaving only as your network policy allowsScans against internal applications or regulated data where the platform must stay in your infrastructure

Who should be allowed to create service accounts and keys

Before any pipeline gets a credential, decide who may mint service accounts and keys, who owns each pipeline identity, and how each issuance is approved and recorded. The cards below cover the decisions that shape that control. Confirm the exact role names and permission set in your own Enterprise or On-Prem instance before you write the policy.

Which role can create service accounts

Start by identifying which built-in or custom role can create a service account and generate its API key. Keep this to a small group of platform administrators rather than every team lead with edit rights on a project. Check whether creating an account and generating a key are separate permissions, since a split lets you grant one without the other. Record the role name and its permission list from your own instance so the policy matches what the platform actually enforces.

Enterprise features

Platform admins or team leads as owners

Decide whether central platform administrators or the owning team lead own each pipeline identity. Central ownership makes offboarding and audits simpler, but it can leave the team that depends on a pipeline unable to fix a broken credential quickly. Team ownership keeps accountability close to the code, but it spreads key creation across more people. Many organizations choose central creation with team-level ownership recorded on the account, so that each key has a named human owner.

Limiting creation with custom roles

Enterprise supports custom roles and permissions, so you can separate the right to view a pipeline's results from the right to create credentials for it. Write down which actions each role may take, such as creating accounts, scoping them to a team, or revoking them. Test the role with a non-admin user before rollout, because permissions that look narrow on paper may still allow creation through a related screen or API call. Confirm the behavior in your instance rather than assuming it.

Approving and recording each issuance

Define who approves a new service account and what evidence the request must include, such as the pipeline name, the repository, the team, and the purpose. Use your ticketing or change system as the record of approval, and check that the platform's audit trail captures who created each account and key. Ask the vendor which events the audit log records and which it leaves out before you rely on it for an access review.

Who receives the key once issued

Decide who sees a key at the moment it is generated, because that is the window in which it can be copied. Limit that step to the approver or the platform administrator, and hand the value directly to the secrets manager that the pipeline reads from, not to a person's chat or email. Confirm whether the key can be displayed again after creation in your version. If it cannot, a lost key means issuing a new one and updating every pipeline that used the old value.

How team scoping limits what a CI key can reach

Team scoping is the control that decides how far a pipeline credential can reach inside promptfoo Enterprise, so tie each CI key to the one team whose targets and results the pipeline actually touches. The Enterprise tier adds teams-based access control, which means a key does not inherit the whole organization's view by default. Start by listing, for each pipeline, the shared targets it calls, the plugin collections it runs and the team that owns the results. Any target or collection that belongs to another team should be a deliberate, documented exception rather than something the pipeline can reach by accident.

Red team results need the same discipline. Scan output often contains sample prompts, model responses and descriptions of weaknesses in a specific application, so a pipeline that writes findings into a team's space exposes that content to everyone who can see the team. Check who holds each role on the team the key belongs to, and confirm that results from a CI run appear only where you expect them. Treat the effective reach of a key as the combination of its team membership, its role and the sharing settings on each target, not as the permissions you intended when you created it. Ask the vendor to document exactly how these are enforced in your edition and version.

Before widening a key's scope, run one pipeline against a non-production team that holds a copy of the target configuration and a test dataset. Confirm that the key can read the intended target, cannot open a sibling team's targets or results, and that its runs appear only in the expected place. Repeat the check after any role change or sharing change, since those alter reach without touching the pipeline. Only then add the production team, and record the outcome so the access review has evidence of what the key was tested to reach.

Setting up a service account for a CI pipeline

This sequence gives a CI pipeline its own scoped identity in promptfoo Enterprise, so the job can run evals without anyone sharing a personal login. It ends with a key stored in your secrets manager, a passing non-destructive run, and a named owner with a rotation date.

  1. Confirm the edition and CLI version

    The platform owner confirms which promptfoo edition the organization licenses and which CLI version the pipeline will install. The npm release 0.124.1 requires Node.js 22.22.0 or newer, so the CI runner image must meet that minimum. Pin the same CLI version in the pipeline definition so every job runs the same code. Verification: run node --version on the runner, then npx promptfoo@0.124.1 --version and confirm the output reports 0.124.1. Confirm with your vendor contact which service account and API key features your Enterprise contract includes before you go further.

  2. Define the team and target

    Before creating anything, the team lead writes down which team owns the pipeline and which target application or model endpoint the job will test. Keep the definition narrow: one pipeline, one team, one target. This decision determines what the service account is allowed to see, so involve the security owner for the target. Verification: a one-paragraph statement that names the team, the target, the pipeline and the kinds of runs it performs (for example, eval only, or eval plus red team scans). If the statement needs more than one team, split the pipeline before continuing.

  3. Create the service account with minimal role

    An administrator creates the service account in promptfoo Enterprise and assigns the narrowest role that still lets the pipeline run its jobs. Enterprise offers teams-based access control and custom roles, so ask your vendor which built-in roles exist and whether a custom role can limit the account to one team and the actions the job needs. Avoid organization-wide administrator roles for CI. Verification: sign in as the service account, or review its permissions, and confirm it can run the planned eval and cannot change users, roles or other teams.

  4. Store the key in the secrets manager

    When the platform issues the API key, copy it once into the secrets store your CI system uses, such as the built-in secret store of your CI platform or an external vault your organization operates. Do not paste the key into pipeline files, tickets, chat or documentation. Restrict who can read the secret to the pipeline and its maintainers. Verification: the secret appears in the CI system's secret list with a name that identifies the team and pipeline, and a test job cannot read it unless it is running on the protected branch or environment you intended.

  5. Expose the key without echoing it

    Map the stored secret to an environment variable in the job definition, using the variable name that the promptfoo CLI documentation for Enterprise authentication specifies. Confirm that exact name with your vendor before use. Disable shell tracing in the job, avoid commands such as printing the environment, and mask the value in the CI system's log settings. Verification: run the job with a deliberately simple command, then search the job log for the key's first and last few characters. The search should return nothing. If the value appears, remove the step that printed it and rotate the key.

  6. Run a non-destructive eval first

    The first pipeline run should be a read-only eval against a non-production target, using a small test suite that makes no changes to the application under test. Choose tests that report results without writing state back to the target. Watch whether the job reaches the Enterprise platform and whether results appear in the team's view. Verification: the job exits successfully, the run appears under the expected team in promptfoo Enterprise, and the results list shows only the team's targets. Any result visible outside the team means the role or team scope needs review before the pipeline runs against other targets.

  7. Record owner and rotation date

    Add a record for the service account in your asset or secrets inventory. Include the owning team, the named individual responsible, the pipeline and target it serves, the role assigned, and the date of the last rotation. Set the next rotation date according to your organization's key policy, and confirm with your vendor how Enterprise handles key expiry and revocation. Verification: a reviewer who has not configured the pipeline can find the record, identify the owner, and state how the key would be revoked and replaced without contacting the original builder.

Protecting keys in storage, logs and the pipeline

A promptfoo key is a credential that can start scans and read results, so it needs the same care as a deployment secret. The cards below cover where keys are stored, how they stay out of logs and artifacts, how pull request jobs are kept away from them, and how to review what the service account does.

Store keys in a secrets manager

Keep the promptfoo key in your organization's secrets manager and inject it into the job at runtime, not in the pipeline definition, a repository file or a shared wiki page. Confirm who can read the secret path, whether reads are logged, and whether the manager can revoke or replace the value without editing every pipeline. Record the owner of each key so a rotation has a named person behind it.

Self-hosting docs

Mask keys and keep them out of artifacts

Assume any value printed to a CI log will be copied elsewhere. Confirm that your CI system masks the secret in console output, and test it by echoing a dummy value in a throwaway job. Check that the scan configuration, environment dumps, debug flags and uploaded reports do not contain the key, since eval output files and cached configs are common leak points. Review artifact retention settings for any job that handles the key.

Split scan keys from reporting keys

Use one key for jobs that run scans and a different, narrower key for jobs that only read or publish results, such as a dashboard step or a summary comment. If a reporting job is compromised, it then cannot start new scans or change configuration. Ask your promptfoo administrator whether role or team scoping can separate these two uses in your edition, and confirm it in the instance before you rely on it.

Limit who can read CI variables

Restrict the pipeline variables that hold the key to protected branches and to the maintainers who need them. Review project, group and organization level variable settings, because a variable defined at a broad level can reach jobs you did not intend. Check whether developers can view variable values in the CI interface, and whether service account tokens can be read by anyone with maintainer access to the repository.

Keep production keys out of forked and external jobs

Pull requests from forks and external contributors often run with limited access, but settings differ across CI systems and some expose secrets to forked code by default. Never give a fork-triggered job a production promptfoo key. Use a separate low-privilege key or run only offline checks for untrusted changes, and confirm in your CI documentation that secrets are not passed to those jobs.

Review service account activity

Check whether your promptfoo edition provides audit logging for service account and API key activity, and confirm which events it records, how long it keeps them and how you export them. Review the log on a schedule for keys that are used from unexpected places, keys that are unused for long periods, and creation of new keys outside the normal change process. The Enterprise audit logging topic covers what those logs capture and what they omit.

Rotating keys without breaking scheduled scans

Rotate a key in the order that keeps scheduled scans running: issue a replacement key, update the secret in your secrets manager, confirm that a pipeline run completes with the new key, and only then revoke the old one. Revoking first is the most common cause of a failed nightly red team scan, because the next scheduled job fails at authentication with no warning. Before you start, confirm with promptfoo whether your Enterprise deployment supports overlapping keys, so that old and new keys can both work during the cutover. Also confirm whether keys expire automatically, what expiry period applies, and whether revocation takes effect immediately or after in-flight jobs finish. Those answers decide how long your window is and whether you need a manual reminder to revoke.

Set the rotation cadence in your organization's own key management policy, not in a number chosen by the scanning tool. Tie each key to an owning team and a named pipeline so that rotation tasks have an accountable owner. Before revoking any key, find every place it is used: pipeline definitions in GitLab CI, Jenkins, Azure Pipelines or other systems, scheduled jobs, developer machines, and any script that reads the secret from the secrets manager. Search your repositories and secret references for the key's identifier and the variable name that carries it, then check the audit trail for recent authentication events under that service account. Keys that appear only in a pipeline nobody remembers are the ones that break scans after revocation.

If you suspect a key has leaked, revoke it first and rotate second. Do not wait for a scheduled rotation window. Issue a replacement, update the secret store, and rerun the affected pipelines to confirm they recover. Then review the audit logs for activity under the compromised service account over the period when exposure was possible, and check whether any scan configuration, team setting or stored result was changed. Record what was exposed, where and for how long, because your auditors and incident response team will ask. Ask promptfoo how audit events for service accounts are retained and exported before you need them during an incident.

Limits to confirm before you depend on service accounts

Service accounts only give a pipeline a controlled identity if the platform behind them does. The cards below separate what the supplied facts already limit from what you need the vendor to confirm in writing before you build key handling around them.

Community server is not an identity boundary

The self-hosted server stores its data in a local SQLite database that cannot be shared across replicas, and it has no RBAC, no built-in authentication and no SSO. Keys issued from it cannot be scoped to teams or revoked through a central control. Treat it as a single-instance evaluation environment, not as the place where pipeline credentials are governed.

Self-hosting docs

Not recommended for production

The self-hosting documentation does not recommend the self-hosted server for production use. If a CI system depends on it for eval or red team runs, a single outage or database problem stops every pipeline that uses it. Decide early whether the workload needs the Enterprise platform before writing pipeline logic that assumes it is always available.

Key lifetime and expiry

Ask whether keys have a maximum lifetime, whether expiry is enforced by the platform or only by your own process, and how long a revoked key keeps working. Your rotation schedule depends on these answers. Get the behavior in writing for each plan you intend to buy.

Permissions per role

Confirm exactly which actions each role can perform, such as running scans, reading results, changing targets or managing other keys. Enterprise offers custom roles and permissions, but the permission set itself is not something to assume. A pipeline key should carry only the actions its job requires.

Rate limits and probe quotas per key

The Community edition includes 10k red team probes per month. Ask whether Enterprise quotas apply per organization or per key, whether one noisy pipeline can exhaust a shared allowance, and what happens when a limit is reached mid-scan. These answers determine how you split keys across pipelines.

Seat counting for service accounts

Ask whether service accounts consume Enterprise seats, since a pipeline that needs a key may be counted like a person. This changes the cost of creating one account per repository or per team. Request the seat rule in the written quote, not only in conversation.

Identity handling in On-Prem

On-Prem runs the Enterprise functionality inside your infrastructure with a dedicated deployment engineer, but the documents supplied here do not describe how service account keys are issued or validated there. Confirm which identity service is used, where keys are stored, and who operates that service before you design pipeline access.

Questions teams ask about promptfoo CI/CD credentials

Can our team set up service accounts and API keys for promptfoo in CI/CD on its own?

Yes, a team with CI administration rights and someone who owns the promptfoo Enterprise tenant can usually do the basic setup alone, since the work is configuring accounts, team scopes and secret references. The harder parts are agreeing who may create service accounts, mapping pipelines to the right teams, and building a rotation routine that survives staff changes. Teams without an identity or secrets manager owner often find those decisions take longer than the configuration itself. Confirm the exact account and key options in the promptfoo Enterprise documentation for your version before you plan the work.

What drives the effort and time needed for CI credential setup?

The main drivers are the number of pipelines that call promptfoo, the number of teams that need separate scopes, how mature your identity integration is, and how your secrets manager is already run. Each pipeline that needs its own key adds a secret to store, a scope to verify and a rotation to schedule. Organizations that already use a central secrets manager with CI integration usually move faster than those building that path from scratch. Ask for a written scope that lists pipelines, teams, the secrets manager in use and the rotation policy, since those items set the effort more than the tool does.

What does the work need from our organization?

It needs a named owner who makes decisions about accounts, scopes and rotation, access to a promptfoo Enterprise or Enterprise On-Prem instance, and CI administrator access to the pipelines that will hold the keys. Your secrets manager team also needs to approve where keys are stored and who can read them. Without a named owner, scope decisions tend to stall and keys end up shared across teams. Before work starts, confirm which edition you have, since the Community edition does not include the Enterprise team and access features this topic depends on.

Do Community edition users need service accounts for CI/CD?

The promptfoo 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. Service accounts and team-scoped keys belong to the Enterprise functionality, which adds teams-based access control, SSO and custom roles. Community users running promptfoo in a pipeline can still use the CLI in CI without an Enterprise tenant, but they will not get centralized account management. Check the promptfoo pricing page for the current feature split before deciding which edition your pipelines need.

Does a service account setup need Enterprise or On-Prem?

Service accounts and team scoping are Enterprise features, so you need either promptfoo Enterprise as a hosted service or promptfoo On-Premise, which runs the Enterprise functionality on your own infrastructure with complete data isolation. The On-Premise option also comes with a dedicated deployment engineer. The self-hosted open-source server is not a substitute for this setup, because the documentation states it has no RBAC, no built-in authentication or SSO, and is not recommended for production. Choose between hosted and On-Premise based on where your data and red team targets must stay.

How should we store and rotate keys used by CI pipelines?

Store each key in your secrets manager, reference it from the pipeline as a masked secret or through the secrets manager's CI integration, and never place it in pipeline definitions, repository files or logs. Rotate keys on a fixed schedule and immediately after a suspected exposure, and scope each key to the single team and pipeline that needs it. Test rotation in a non-production pipeline first so a key change does not break scheduled red team scans. Confirm with your security team how long old keys remain valid during rotation, because the answer depends on your secrets manager and promptfoo settings.

What should a quote for this work include?

A quote should list the in-scope pipelines, teams and service accounts, the identity and secrets manager systems involved, and the rotation policy the organization wants. It should name who does each task, including what your team provides, and separate one-time setup from recurring work such as rotations, reviews and upgrades. Ask how verification will be shown, for example a test pipeline run per scope and a record of who can read each secret. Because promptfoo Enterprise pricing is custom, ask for the promptfoo license cost separately from the implementation scope so the two can be compared.

How DeployOpen scopes and delivers CI credential work

DeployOpen approaches service accounts and API keys for promptfoo in CI/CD as a scoped piece of access design, not a one-off configuration step. We agree the scope in writing first, then build and document the setup inside your own infrastructure so your security and platform teams can review and operate it. Engagements are fixed-scope, and ongoing support is available as a retainer.

How we scope

  • Inventory which pipelines, repositories and promptfoo Enterprise teams need programmatic access, and which should have none.
  • Agree in writing who may create service accounts, and which roles and team boundaries each key may use.
  • Confirm with your team which promptfoo edition and deployment (hosted Enterprise or On-Prem) the written scope covers before work begins.

How we build

  • Configure one service account per pipeline or team, with scoped keys, and record the mapping in a reviewed register.
  • Store keys in your existing secrets manager and inject them into CI jobs, keeping them out of repository files and job logs.
  • Test that each key reaches only its assigned team and fails cleanly when used outside its permitted scope.

How we hand over

  • Deliver written runbooks covering key creation, revocation, rotation steps and the owner of each service account.
  • Walk your security and platform engineers through the access model so they can review it without relying on us.
  • Document the verification evidence from testing, including scope checks and rotation dry runs, for your access reviews.

How we support

  • Offer retainers for rotation support, access reviews and changes when new pipelines or teams are added.
  • Retest key scopes after upgrades or changes to your identity or secrets setup, and report any drift.
  • Confirm with the vendor or your own environment which key lifetime and rotation features your promptfoo version provides before you rely on them.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.