Loading promptfoo test cases from SharePoint

Load promptfoo test cases from a SharePoint CSV file by fetching it through Microsoft Graph with an Azure AD app, then pointing promptfoo at the local copy. No native SharePoint loader is confirmed, so confirm that first and plan the fetch step as code you own and verify.

On this page

How promptfoo test cases load from SharePoint CSV files

promptfoo evaluates against files it can read, so SharePoint access has to sit in a fetch step that runs before the eval starts. The step calls Microsoft Graph, authenticates as an Azure AD app registration and downloads the CSV that holds your test cases. For this setup, the app authenticates with a certificate through the @azure/msal-node library and requests the Sites.Read.All permission. Before you promise a native SharePoint loader to stakeholders, confirm it in the promptfoo documentation for the version you run, because a native loader is not confirmed for promptfoo. Start with the promptfoo introduction to check which test sources your version supports.

Three decisions shape the fetch step before any code is written. First, ask your tenant administrator who will grant admin consent for Sites.Read.All, since this application permission reaches every site in the tenant and needs approval at that level. Confirm whether your organization can scope access more narrowly, to the one site that holds the file. Second, decide where the certificate's private key lives. Keep it in a secrets manager or your runner's secure store, out of the repository that holds the promptfoo config, and set a rotation date before the certificate expires. Third, record the tenant ID, client ID, site identifier and file path in one config file, so a moved or renamed file becomes a visible change in version control and the fetch step fails loudly.

Plan for three failure modes. An expired certificate or missing admin consent stops the fetch with an authentication error, so run the fetch as its own step before the eval and treat its failure as a blocked run. A fetch can also succeed and still hand promptfoo the wrong data, such as an old copy or an empty file, so check the header row and row count of the downloaded CSV before the eval starts. Finally, teams reorganize sites and rename libraries, which breaks the identifiers in your config. Test the fetch step after any change to the site, and record which file version each eval run used so that later comparisons make sense.

What the promptfoo SharePoint integration needs before work starts

Most delays in a SharePoint-backed promptfoo setup come from access and ownership, not from code. Each item below needs a named owner before the build starts, and each should be confirmed in your own Microsoft tenant and runner environment.

Node.js 22.22.0 or newer

promptfoo requires Node.js 22.22.0 or newer. The host that runs evals, and any machine where you run the CLI during setup, must meet this minimum. Check the version on every host and build image that will load the CSV, including CI runners and container images, because base images often ship older Node.js releases. Confirm the version with your platform team before anything else, since a runtime mismatch is the quickest failure to rule out early.

Pinned promptfoo release

Choose the promptfoo release the integration will run on and record it in your repository. The npm release 0.124.1 was published on 8 October 2026, and this page is written against that version. Pin the version explicitly. Before pinning, check the npm registry and the GitHub releases page for newer versions, read the changelog for changes to data loading, and test the pinned version in a staging workspace. Treat later upgrades as controlled changes to the runner.

Entra tenant with app registration rights

Someone must be able to register an application in Microsoft Entra ID and grant admin consent for the Sites.Read.All permission. Confirm with your identity team who holds that role, whether tenant policy restricts app registration, and who approves the consent request. The integration reads the CSV through an app identity, so no individual's user account should be a dependency. Record the tenant ID and the registration owner in the project file before work starts.

SharePoint site and CSV with owners

Identify the SharePoint site, the document library and the CSV file the suite will read, and name an owner for the file. Confirm that the file is saved as CSV with a header row, because column names decide how promptfoo maps values to variables. Ask the owner who edits the file, how changes are reviewed, and who to contact when a row breaks a run. Test data changes outside the repository, so the suite can change without a code change, and the owner must know that.

Certificate and private key for the app

The app authenticates with a certificate and its private key, and the integration does not use a client secret. Decide who generates the key pair, where the private key is stored and how it is rotated before the app registration is created. Confirm that the runner can read the key at run time through your secrets mechanism, and that the key never reaches the repository or eval output. Record the certificate expiry date so renewal is scheduled before the integration stops.

Outbound access to Microsoft endpoints

The runner must reach the Microsoft sign-in endpoint and the Microsoft Graph endpoint over HTTPS from the network where evals run. Ask your network team whether egress passes through a proxy or a firewall with allow-lists, and whether those rules cover the login and Graph hosts for your cloud. Test from the exact runner, including CI agents and containers, because a laptop check can pass while the pipeline fails. Confirm each host name against your own environment rather than assuming the defaults.

The fetch step hands promptfoo a plain CSV file

The flow starts in the CI job or runner, where the fetch script uses @azure/msal-node to present the app's certificate to Microsoft Entra ID. Entra returns a token that carries the Sites.Read.All permission. The script calls Microsoft Graph with that token, and Graph returns the CSV stored in SharePoint. The script writes the content to a local CSV file, and promptfoo reads only that file to run the eval and write results. Check that the certificate stays on the runner and that the app holds no more access than the fetch needs.

The fetch step moves a SharePoint CSV into promptfoo through a local file.

Setup steps for the promptfoo SharePoint integration

This sequence connects a SharePoint CSV file to promptfoo through an Azure AD app that authenticates with a certificate. Each step ends with a check you can run yourself, so a fault surfaces where it was introduced. Microsoft 365 administrators own the app registration and consent, while the engineers own the fetch script and the promptfoo configuration that reads its output.

  1. Register the Azure AD app

    An administrator with rights to create app registrations creates a single-tenant Azure AD app for the fetch job and copies its application (client) ID and directory (tenant) ID. Keep the app limited to this job: no redirect URI, no user sign-in flow, since the script runs with app-only access. Store both IDs in your secret store or deployment settings. Done when the app appears in the registrations list and both IDs are saved.

  2. Upload the certificate public key

    Generate a certificate on a machine you control, upload only the public certificate to the app's certificates section, and load the private key into your secret store with read access limited to the account that runs the fetch. Confirm the thumbprint shown on the app matches the certificate your store returns. Done when the two thumbprints are identical and the private key is not present in the repository or CI logs.

  3. Grant Sites.Read.All and record consent

    Add the Microsoft Graph application permission Sites.Read.All to the app, which lets it read every site collection in the tenant. Then have an administrator with rights to grant tenant-wide consent approve it. Narrower options may exist, such as Sites.Selected with a per-site grant, so confirm with your Microsoft 365 team whether it fits your data boundary before consenting. Record the approver and date. Done when the permissions list shows admin consent granted for your tenant.

  4. Install @azure/msal-node in the fetch project

    In the project that holds the fetch script, install @azure/msal-node with npm and commit the updated lockfile. Use Node.js 22.22.0 or newer, which promptfoo 0.124.1 requires, so both tools share one runtime. Confirm the installed version with npm ls before writing any code that depends on it. Done when a short test script acquires an app-only token for Microsoft Graph using the certificate, without error.

  5. Write the fetch script to a fixed path

    Write a Node script that acquires a token with the certificate, requests the SharePoint CSV through Microsoft Graph, and saves it to one fixed path, such as a test-data directory in the repository. Read the site, drive and file identifiers from environment variables, and overwrite the file on every run so promptfoo always reads the same name. Done when the script returns a Graph file response, writes the CSV, and the row count matches the file in SharePoint.

  6. Point the promptfoo configuration at the file

    In the promptfoo configuration, set the tests key to the fixed CSV path so the file becomes the test source. Run the fetch script before each eval, either as a step in your pipeline or in a local wrapper command, so the file is current. Keep the path identical to the one the script writes. Done when promptfoo parses the file and the eval summary lists the same number of test cases as the CSV has data rows.

  7. Run a dry run against SharePoint

    Run the fetch script, then run promptfoo eval once with a provider and credentials you already use, so the check focuses on data flow and the evaluation finishing cleanly. Compare the row count in the output with the SharePoint file. Open a few results and trace each back to its line in the CSV. Done when the run completes with no fetch or parse errors and the counts match.

Mapping SharePoint CSV columns and identities to promptfoo

This table pairs each SharePoint or Entra item with its promptfoo counterpart and the check to run before the first eval. Read each row left to right: the item, where promptfoo uses it, and what to confirm. The main takeaway is that a failed load usually traces back to a header, encoding, identity or permission mismatch, so check those first before changing the eval config.

Itempromptfoo sideWhat to check
CSV column headersEach header becomes a test variable in vars, and assertion values read the expected-value columnsHeader names match variable names exactly, including case, spaces and underscores
Byte order mark and encodingThe fetch step reads the file as text before the CSV parser splits rowsSave as UTF-8 without a byte order mark, or confirm the parser strips it, since a BOM can corrupt the first header
DelimiterThe CSV parser must be told which delimiter the file usesConfirm comma or semicolon in files exported from regional Excel settings before the first run
Site and file pathFetch script configuration names the SharePoint site and the file's path in the document libraryCopy both values from SharePoint itself, and confirm the file has not been moved or renamed
Entra app registration and client IDThe token request identifies the app registration that holds the Graph permissionTenant ID and client ID match the registration your Entra admin manages
Certificate thumbprintThe token request signs with the certificate whose thumbprint is set in the fetch configurationThumbprint matches the certificate uploaded to the app registration, and the certificate is not near expiry
Sites.Read.All permissionThe Graph read call uses the token to read the site and fileApplication permission has admin consent; this scope covers all sites in the tenant, so ask whether a narrower option such as Sites.Selected is acceptable
@azure/msal-node dependencyThe fetch script uses it to acquire tokens from Entra IDPin the version in the lockfile and confirm it runs on your Node.js version, which promptfoo requires to be 22.22.0 or newer
Who owns each identity and secretThe eval team runs the fetch, while the Entra admin owns the app registration and certificateNamed owner for the app, certificate and secret store entry, with a recorded rotation process agreed in writing

Securing the SharePoint app, certificate and test data

The SharePoint setup has three parts that need protection: the Azure AD app and its certificate, the Graph permission that reads the site, and the CSV and results that carry your test data. The cards cover the decision or check for each part, in the order they usually come up during rollout.

Protect the certificate private key

The app authenticates with a certificate, so the private key is the credential that matters. Keep the key out of the repository, container images and CI variables that print values to logs. Load it at runtime from a secret store your CI system can read, and confirm that pipeline logs, debug output and promptfoo reports never show the key material or the access token. Check who can export the key from your store, and assign a named owner for rotation.

Why certificate authentication

A client secret is a string that can be copied from a pipeline variable or config file and used from anywhere until it expires. With a certificate, the private key stays in your secret store and only the public certificate is registered on the app. Confirm that your tenant policy allows certificate credentials on this app and that your team can rotate the certificate before it expires, so the loader does not fail on a surprise date.

Breadth of Sites.Read.All

Sites.Read.All lets the app read every SharePoint site in the tenant, including the one holding the test CSV. Your security team will ask about that scope during review. Confirm whether a narrower option, such as a permission limited to the single site or library, is available in your tenant and works with the @azure/msal-node flow used here. Record the decision and the administrator who approved the grant.

Restrict the downloaded CSV

Test cases often contain customer phrasing, account details or internal policy text, so the CSV is sensitive even though it sits in a test workflow. Decide whether the file is written to disk at all, where it lives during a run, and when it is deleted. Add a cleanup step that removes the file even when the eval fails. Also confirm whether eval results keep the row variables, because if they do, the results need the same handling.

Scrub secrets from output

Eval output, debug logs and CI console output can capture request details, errors or environment values when a load fails. Run a deliberately failing load with debug logging on, then search the output for the access token and any header values. Decide which artifacts your pipeline publishes, and confirm which fields promptfoo reports include before anyone shares them outside the team.

Access to the self-hosted server

The self-hosted promptfoo server runs an Express app that serves the web UI and API, and its documentation states that it has no built-in authentication or SSO. Anyone who can reach it can read eval results, which may include the test data. Decide who can reach the server, and place it behind a network boundary and an authenticating proxy that you operate. SSO and team access control are Enterprise features, so confirm that edition before you plan around them.

Self-hosting docs

Choosing when the SharePoint CSV is fetched

With run-time fetching, each eval reads the CSV from SharePoint before it starts. The promptfoo config points at the file through the SharePoint loader, and the run authenticates with your Azure AD app, so every run sees whatever the file contains at that moment. This suits a suite that changes often and is edited by domain experts who expect their changes to be tested the same day.

  • Freshness: Each run reflects the latest saved version, so an edit made shortly before a run is tested without an extra step.
  • Failure handling: A SharePoint outage, an expired certificate or a changed permission stops the run before any model call, so failures appear as access errors in logs.
  • Audit trail: The run shows the test data as loaded, but a specific file version is recorded only if your pipeline captures it. Confirm with your logging setup whether the SharePoint version is stored with each eval.
  • Reproducibility: Rerunning a past eval later may load a different file, so a rerun can produce different results even with the same prompts and model.

Before choosing this option, confirm that certificate rotation and tenant permissions let CI jobs authenticate without manual steps.

Verifying the SharePoint pull before trusting eval results

Test the fetch and the eval as two separate steps, and let the eval run only after the fetch has passed. Start by confirming that the token request succeeds and that the Microsoft Graph call returns the file you expect: the right site, the right document, and a body that parses as CSV. A common silent failure is an HTML sign-in page or a Graph error document saved under the test file's name. Then compare the row count and column headers in the downloaded file against the same file opened directly in SharePoint, so a stale version or a renamed column is caught before any model is called. Record the file's last modified time in the run output so reviewers can see which version was evaluated.

Next, run a two-row test to confirm variable mapping. Point the loader at a test file with only two rows, deliberately including one value with a comma, one with a line break and one empty optional cell. Check that each column lands in the prompt variable you intended, and that the empty cell stays empty instead of picking up the previous row's value. Then test the failure path in a non-production setup: use a wrong site identifier or a certificate the app does not trust, and confirm the run exits with an error and writes no results. The loader must never fall back to an old local copy or an empty test set, because either one produces a passing run that proves nothing.

Repeat these checks whenever something the fetch depends on changes. After certificate rotation, confirm the new certificate is registered on the Azure AD app, that the loader authenticates with it, and that the row count still matches SharePoint, keeping the old certificate valid until the new one is proven. After a permission change, such as a new admin consent state or a change to the Sites.Read.All grant, confirm the app can still read the target site. Because Sites.Read.All grants read access across the tenant's sites, also confirm what else the app can reach. After a promptfoo upgrade or a change to @azure/msal-node, rerun the two-row test and compare the output with the last run you trusted, since a dependency update can change how headers or tokens are handled.

Common promptfoo SharePoint integration failures

This table lists the failures teams most often hit when promptfoo reads a CSV from SharePoint through an Azure AD app, with the likely cause and fix for each. Read it from the symptom down, and match the error text in your own logs to the closest row before changing settings. Confirm the exact messages your runner prints, because token and Graph errors can vary by tenant, library and client library version.

SymptomLikely causeFix
Token request fails with a certificate errorThe certificate file or thumbprint in the config does not match the certificate uploaded to the Azure AD app registrationRe-export the public certificate, upload it to the app registration, and copy the thumbprint from Azure into the config exactly as shown.
Token request fails with an expired or invalid credentialThe app's certificate has passed its end date, or the private key file was replaced without updating the registrationCheck the certificate end date in the app registration, issue a new certificate and roll it out before the old one expires.
Graph returns access denied for every requestAdmin consent for the application permission has not been granted in the tenantAsk a tenant administrator to grant admin consent for the permission, then rerun the test against one file.
Graph returns access denied for the site or libraryThe permission is delegated instead of application, or Sites.Read.All is missing from the app registrationSet Sites.Read.All as an application permission, grant consent, and confirm the change in the app's API permissions page.
Site or file cannot be foundThe site ID, drive ID or file path was copied from a different site, or a folder in the path has been renamedResolve the site and file through a test Graph call, then paste the returned identifiers into the config.
Variables are empty or columns fail to mapCSV headers do not match the variable names in the config, or the file was saved with a byte order mark or a non-UTF-8 encodingSave the file as UTF-8 without a byte order mark, match header names exactly, and check the first header for stray characters.
Runner fails at startup or during installThe runner uses Node.js below 22.22.0, which is the minimum for the promptfoo 0.124.1 release and laterRun node --version on the runner, upgrade Node.js to 22.22.0 or newer, and pin the promptfoo version in your lockfile.
Results reflect an older version of the test fileA cached copy of the CSV from an earlier run is still being read, so the download was not refreshedClear the cached download, check the file's modified time in SharePoint, and log the file version each run reads.
Token or Graph calls time out or are refusedAn egress firewall or proxy on the runner network blocks the Microsoft login or Graph endpointsAllow the Microsoft login and Graph endpoints from runner networks or configure the proxy, then confirm the change with your network team.

Questions buyers ask about SharePoint test case loading

How much does a SharePoint test case loader cost to set up?

Cost comes from the people hours behind four pieces of work: tenant access setup, the fetch script, pipeline changes and certificate handling. A tenant administrator must register the Azure AD app and approve its permissions, an engineer must write and test the fetch script, and someone must wire it into your pipeline. Cost rises with the number of sites and files, with the number of approval rounds your tenant requires, and with the number of certificates and pipelines you manage. Recurring costs are the ones to plan for: certificate renewal, script maintenance when a site or file moves, and periodic access reviews. Ask any quote to separate one-time setup from ongoing support, to name who performs each step, and to state which assumptions about file counts and sites it depends on. Most engagements are fixed-scope, and a quote follows from the written scope.

How long does it take to load promptfoo tests from SharePoint?

The duration depends on how quickly tenant approvals clear, how many sites and file layouts the fetch step must handle, and how many pipelines need the change. A setup covering one site, one CSV file, one certificate and one pipeline moves faster than a multi-site rollout, because each added site or file adds mapping and testing work. Approval time sits outside the engineering work, so send the request to your Microsoft 365 administrators early. Test environment availability also matters: if no non-production site exists, the team must create or agree one before it tests against real test cases. Ask for a timeline in the written scope that lists these dependencies separately, so you can see which one controls the date. No duration applies until the scope is agreed in writing.

What access does a SharePoint test case setup need from IT?

Your team must provide a tenant administrator who can register the Azure AD app and grant admin consent for Sites.Read.All, an application permission that can read sites across the tenant. Ask your Microsoft 365 administrators how far that permission reaches in your tenant and whether a narrower grant fits your policy before anyone approves it. File owners must confirm which sites and CSV files hold the approved test cases and who may change them, because the fetch step reads whatever sits at those locations. You also need a test environment: a non-production site or tenant where the fetch step can run without touching production content, plus a promptfoo run that uses it. Record each approver and each grant in writing before the build starts, so the access trail is available to your security and compliance reviewers.

Can our internal team set up SharePoint test loading alone?

Yes, an internal team can do this without outside help if it has the skills for each piece: Azure AD app registration, certificate-based authentication, a Node.js fetch script using the @azure/msal-node dependency, and changes to your CI system. The question to settle first is ownership after go-live. Someone must renew certificates, update the script when a site or file moves, and respond when a scheduled run fails. If a named engineer will hold those duties after handover, an internal build is workable. If not, a fixed-scope engagement can cover the build, documentation and handover, and a retainer can cover upkeep. DeployOpen plans, implements, integrates, documents and supports self-hosted open-source platforms in infrastructure you control, so the work can be scoped to your team's gaps.

Does promptfoo have a native SharePoint loader for test cases?

We have not confirmed that promptfoo ships a native SharePoint loader, so check the current promptfoo documentation and the release notes for the version you run before you choose a design. The approach in this guide does not depend on one. It uses a fetch step that downloads the CSV from SharePoint to a local path, and promptfoo then reads that local file like any other CSV test source. If your version has a native loader, it may still need the same Azure AD app, certificate and permission setup, so the tenant work stays. Confirm the loader's behavior, supported authentication methods and required permissions before you compare effort. The promptfoo introduction is a starting point for checking the current feature set.

Why use a fetch step instead of a SharePoint link in promptfoo?

A fetch step keeps SharePoint credentials and file locations out of the promptfoo config, which people share and commit to version control. The config points to a local CSV path, and the fetch step, run before the eval, handles sign-in, downloads the file and writes it to that path. This separates three concerns: tenant credentials stay in your secret store, the config stays readable and reviewable, and each eval runs against a stable file that you can inspect when a run looks wrong. A direct link would require promptfoo itself to handle certificate-based sign-in and token refresh, which you would need to confirm for your version. The trade-off is one more moving part to test, version and own, so the fetch script needs logging, clear failure messages and a named owner.

How DeployOpen scopes and delivers the SharePoint integration

DeployOpen treats loading promptfoo test cases from SharePoint as fixed-scope work, with a written scope agreed before any build starts. Delivery happens inside your own infrastructure and cloud accounts, and ongoing support is available as a retainer.

How we scope

  • The written scope names the SharePoint site, document library and CSV files that act as test sources.
  • It records the Azure AD app registration, certificate-based authentication and the Sites.Read.All permission to be granted.
  • Engagements are fixed-scope, so deliverables and timelines are agreed in writing before work starts.

How we build

  • Register the Azure AD app, configure certificate credentials and grant the agreed Sites.Read.All permission in your tenant.
  • Add the @azure/msal-node dependency and the loader configuration so promptfoo reads CSV test cases from SharePoint.
  • Test the loader with a sample file, including a run where access is denied, before the suite is used.

How we hand over

  • Handover covers the configuration files, app registration settings, and the steps to rotate the certificate.
  • Documentation explains which SharePoint files your team edits, who owns them, and how changes reach the eval.
  • We walk through the run with your engineers so they can rerun the loader and read its errors.

How we support

  • Retainer support can cover credential expiry, permission changes and updates to the promptfoo version you run.
  • Upgrades are planned in advance, with the loader and suite retested before the change reaches your main branch.
  • Retesting after changes to SharePoint permissions or site structure keeps the suite loading as expected.

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.