How PyRIT .env and .pyrit_conf files shape a team setup
A team lead who must make PyRIT usable on several workstations has to decide where credentials live before anyone copies a config file. PyRIT reads credentials from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf, so each user's home directory holds both files on every machine. The split matters. The .env file is where endpoint keys and other secrets belong, and it should be the only file that carries them. The .pyrit_conf file holds non-secret behavior, such as the memory database and labeling conventions, so the team can review and share it without exposing anything sensitive.
An individual tester working against one endpoint can usually run on the defaults, with a personal .env holding one key. A team needs a deliberate layout once several people share targets, labels or memory. Decide which settings every workstation must match and which are personal. Put the shared values in one reviewed .pyrit_conf template, and keep each person's .env out of version control and out of shared drives. Before you standardize, confirm in the PyRIT documentation which settings each file controls and how PyRIT resolves them, rather than assuming a loading order.
Standardize the Python version before rollout. The PyPI package supports Python 3.10 through 3.14 (up to but not including 3.15), and the documentation recommends Python 3.13, so use 3.13 unless your platform team has a reason to choose otherwise. Install with pip, then confirm that both files resolve from the account that runs scans, including CI runners and shared workstations. This section covers configuration only. Secret storage in Azure Key Vault, Entra ID sign-in for Azure targets and request limits have their own sibling pages, and each decision changes what goes into .env and .pyrit_conf.
Which configuration option fits which team situation
This table compares the PyRIT configuration options a team is likely to choose between, covering what each holds and what it risks if committed or shared. Read each row against your own situation, and confirm exact key names and loading behavior in the PyRIT documentation before you write shared files.
| Option | When it fits | What it holds | Risk if committed or shared |
|---|---|---|---|
| Single .env in ~/.pyrit | One person working on their own machine, with a single set of endpoints and keys | Credentials for the targets and services PyRIT calls, read from the home directory | Keys leak if the file is copied into a repository, shared drive or chat; rotate any exposed key |
| Local .env.local override | One person who needs a different endpoint or key for a test run without changing the base file | Local replacements for selected values, layered over the base .env | Easy to forget it exists and to send it with a support bundle; confirm the loading order in the docs |
| Settings in .pyrit_conf | Any setup where non-secret behavior, such as memory choice or defaults, should be consistent | Settings for PyRIT behavior, read from ~/.pyrit/.pyrit_conf | Low secret risk, but a shared edit can silently change results for everyone who uses the file |
| SQLite memory | Individuals and small teams on one workstation or one shared machine with a local database | Conversations and results stored in a local SQLite database | The file holds full attack transcripts; restrict file permissions and do not sync it to shared storage |
| Azure SQL memory | Teams that need a central, shared results store and an Azure-hosted database | Conversations and results stored in Azure SQL | Connection details and access rights are shared; confirm authentication method and who can read transcripts |
| Initializers and labels | Teams that want the same targets, scorers and labels available to every operator | Named registrations for endpoints and tags used to group runs | Registered names can point at production endpoints; review initializers before sharing them |
Setting up .env and .pyrit_conf for a team
This sequence takes a team from a clean machine to a PyRIT installation where credentials live in .env, settings live in .pyrit_conf, and every value can be traced to the file that supplies it. The result is a configuration each engineer can reproduce without putting secrets into source control.
Install PyRIT on a supported Python version
Create a virtual environment on a Python version the PyPI package supports, which is 3.10 up to but not including 3.15, and install the
pyritpackage with pip. The PyRIT documentation recommends Python 3.13, so pin that version in your team's setup guide if your platform offers it. Runpip show pyritin the environment and record the version in your team runbook so every engineer starts from the same release. Done when the package imports cleanly in a fresh shell.Create the shared PyRIT home directory
Create the
~/.pyritdirectory on each workstation or runner that will run PyRIT, and set its permissions so only the account that runs tests can read it. This directory holds the two files PyRIT reads by default,.envfor credentials and.pyrit_conffor settings. Confirm the directory exists and is not inside any folder that a Git client syncs. Done whenls -ld ~/.pyritshows owner-only access on a Unix-like system.Place credentials in the .env file
Add endpoint keys and tokens to
~/.pyrit/.env, one variable per secret, using the variable names listed in the PyRIT documentation for each target. Keep local test values in a separate.env.localonly if your team has agreed on a loading order that everyone follows. Check the loading order in the current documentation before relying on override behavior. Done when a dry run reports the target as configured and the secret values do not appear in shell history or logs.Set non-secret behavior in .pyrit_conf
Write
~/.pyrit/.pyrit_confto hold settings that are safe to share across the team, such as default target names, scorer choices and memory options. Keep this file free of keys so that it can be copied between machines or reviewed in a ticket. Ask your platform owner which settings are approved for shared use. Done when the file contains no credential-like strings and a reviewer can read every line without a secrets scanner.Choose and record the memory database
PyRIT memory stores conversations and results in SQLite or Azure SQL, so decide which one each environment uses before the first run. SQLite suits a single workstation, while Azure SQL is the usual choice when several people or runners must write to shared records. Record the chosen backend and its location in
.pyrit_confand in your runbook, and confirm with your security team where the database file or server is allowed to live. Done when a test run writes a record and you can find it in the backend you named.Add initializers and labels for the team
Register your organization's targets and scorers through an initializer so scenarios and the command line can find them by name, and attach labels to runs so results can be grouped by project or owner. Agree on a label naming convention with the people who will read the results later. Check that the initializer loads without error and that each label appears on the records written by a test run. Done when the expected target names are listed by the tooling and the labels match your convention.
Verify which file supplied each value
Run a short check that prints the effective configuration, then confirm for each key whether it came from
.env,.pyrit_conf, an environment variable or a default. Mismatches usually mean a stale variable in the shell or a second copy of a file in another folder. Scan the project repository with a secrets detection tool and confirm that.env,.env.localand any database file are listed in.gitignore. Done when every key has a known source, the scan finds no credentials, and the team has written the verified values into its runbook.
How PyRIT resolves credentials and settings at startup
The run begins on the local workstation and reads ~/.pyrit/.env for credentials, then ~/.pyrit/.env.local if that file is present. It then reads ~/.pyrit/.pyrit_conf for settings, selects SQLite or Azure SQL for memory, and registers initializers so targets, scorers and techniques can be found by name. Only the target calls leave the workstation and reach model endpoints outside it. Before relying on any override order between these files, confirm the precedence in the PyRIT documentation for your version.
Startup order for PyRIT config files, memory selection and the workstation trust boundary.
Keeping PyRIT configs out of source control
PyRIT reads credentials from a local .env file and settings from a .pyrit_conf file, and both can hold endpoint details that should never reach a shared repository. The controls below cover ignore rules, templates, commit scanning, team separation and key rotation. Confirm any PyRIT-specific ignore behavior against the current documentation before relying on it.
Ignore local env files
Add .env and .env.local to the .gitignore of every repository that touches PyRIT, including scenario folders, notebooks and CI helper scripts. Ignore rules only apply to files that were never staged, so check whether any copy was committed before the rule existed. Confirm with the PyRIT documentation which file names PyRIT reads from its home directory and whether any project-level file is loaded, so the ignore rules match the real load paths.
Never commit the PyRIT home folder
The ~/.pyrit folder holds the .env credentials file and the .pyrit_conf settings file, and it can be copied into a project by mistake when someone sets up a dev container or backs up a workstation. Keep that folder outside every repository and exclude it from any dotfile sync tool. Treat any copy inside a repository as a credential exposure, not a cleanup task.
Commit placeholder templates
Keep a template such as .env.example in the repository with placeholder values and comments that explain each key. Developers copy it to their home folder and fill in real values locally. Reviewers can then see which settings a scenario depends on without seeing any secret. Keep the template current whenever a target or scorer changes its required settings.
Scan commits for keys
Run a secret scanner in pre-commit hooks and in the hosting platform's push protection, and scan the full history of any repository that once held PyRIT settings. Scanners catch common key formats but may miss custom endpoint keys or connection strings, so add a review step for changes to config and notebook files. Ask your security team which scanner and ruleset they already operate, so PyRIT repositories are covered by the same policy.
Split team configs from shared initializers
Shared initializers and registries describe what targets and scorers exist, which is reasonable to version in a team repository. Per-person settings, such as endpoint keys, subscription IDs and personal database paths, belong in each user's home folder or in a managed secret store. Keep the two in separate repositories or folders so a pull request that updates an initializer cannot also change credentials.
Rotate keys after any copy
When a .env file is copied to a laptop, shared to a colleague, or found in a repository, rotate the affected keys at the provider and do not rely on deleting the file. Record who holds which key so the rotation list is short. Confirm with each target provider how keys are regenerated and whether Entra ID or managed identity removes the need for stored keys on Azure targets.
Choosing SQLite or Azure SQL memory for PyRIT results
Choose the memory backend before the first team run, because it decides who owns the results, who backs them up and who can read them. PyRIT memory stores conversations and results in either SQLite or Azure SQL. For a single analyst working on one workstation, a local SQLite database is usually the simpler starting point: the file sits with the person running the tests, it needs no database service, and it moves with them. The trade-off is that the analyst also owns the file. Nobody else is responsible for backing it up, restoring it after a laptop failure or deciding when it is retired, and the file carries every prompt, response and score from the engagement, so it should be stored with the same care as the test data itself.
A shared team changes the calculation. Several people writing to one SQLite file on a shared drive is fragile, and a copy on each workstation fragments the evidence. Azure SQL gives the team one managed place for results, with access controlled at the database level and backups handled by the service owner. Ask the team who will run scans, whether more than one person writes at the same time, who may read conversations that may contain harmful content, and how long results must be kept. Also confirm which backup and retention settings your Azure SQL service owner will apply, since those settings are not decided by PyRIT. Results feed later reporting only if the records are complete and queryable, so decide early who will export or query them for findings and for any compliance evidence. Keep the backend choice consistent across the team's .pyrit_conf files so that results from different people land in the same place.
Before choosing, put four questions to the team: how many people will write results and at what times, where the database file or server must live under your data handling rules, who needs read access and who must be kept out, and who is accountable for backup and restoration. If the answer points to Azure SQL, authenticating to it with Entra ID instead of a password or key is covered on the sibling page on Entra ID authentication for Azure targets, so this section does not repeat those login steps. Confirm the current SQLite and Azure SQL setup keys against the PyRIT documentation for your installed version before writing them into a shared file.
Questions teams ask before configuring PyRIT
Can one engineer set up PyRIT configuration alone?
Yes, for a single person working on one machine against a small number of targets, the setup is usually a matter of installing the package, creating a .env file for credentials and a .pyrit_conf file for settings, and running a first test. PyRIT installs with pip and the PyPI package supports Python 3.10 up to but not including 3.15, with the documentation recommending Python 3.13. The work becomes a team task when credentials must be shared safely, when several people run scans against the same endpoints, or when results must be traceable. Confirm the Python version and package details against the PyRIT documentation before you start.
What drives the effort of a PyRIT configuration?
The main drivers are the number of targets, whether the workstation is shared, the database choice, and the number of initializers you need. Each target needs its own endpoint settings and credentials, so ten endpoints take far more care than one. A shared workstation or CI runner adds decisions about where secrets live and who can read them. PyRIT memory stores conversations and results in SQLite or Azure SQL, and that choice determines backup, access and multi-user needs. Every custom initializer adds a registration step that must match your endpoint names. Ask for each of these counts to be fixed in writing before estimating work.
What access and decisions does the team need to provide?
Three things should be ready before configuration starts. First, access to each endpoint the team plans to test, including the endpoint address, the authentication method and a test account that can send prompts without touching production users. Second, a decision on memory: whether results stay in local SQLite, move to Azure SQL, or sit in a location your compliance team has approved. Third, a named secrets owner who controls the .env values and any Azure Key Vault access. Without the secrets owner, credentials tend to end up in shared notes or source control, which is the risk the configuration is meant to prevent.
How long does a basic PyRIT setup take?
A basic setup for one user and one or two targets is short, often a single working session for an engineer who already knows Python and the endpoints involved. Duration grows with the number of targets, the number of people who need access, the secrets approach, and how much testing is needed to confirm that each target responds as expected. Because the scope of each environment differs, DeployOpen does not give a fixed timeline in advance. Ask for a duration in the written scope, with the target count and environment listed, so the estimate can be checked against those inputs.
Should we hire outside help to configure PyRIT?
Hire help when the setup has to meet security or compliance review, when several teams share the framework, or when your engineers lack time for the checks. Doing it in-house is reasonable for a small group with clear endpoints and an internal owner for secrets. Outside help adds value in areas that are easy to get wrong: keeping .env files out of source control, choosing a memory location that suits your records needs, separating team configurations, and testing that the endpoints respond as intended. DeployOpen plans, configures and documents self-hosted platforms in infrastructure you control, so the work stays inside your environment.
What should a quote for PyRIT configuration include?
A useful quote lists the scope in writing before work starts. It should name the number of targets and their types, the workstations or runners to configure, the memory database choice and where it runs, the initializers to build, and how credentials will be stored and loaded. It should state the deliverables, such as configuration files, a setup guide, and a handover session, and the acceptance checks used to confirm each target works. It should also say what is one-time (setup and documentation) and what recurs (updates when PyRIT releases change, and any retainer support). Ask what is excluded, including endpoint changes that happen after handover.
Where should the `.env` and `.pyrit_conf` files live?
PyRIT reads credentials from ~/.pyrit/.env and settings from ~/.pyrit/.pyrit_conf, so the default location is the user's home directory. Keep these files out of source control, and never commit them to a shared repository or paste them into tickets. On a shared workstation, each user needs a separate home directory or a deliberate arrangement for their files. For teams, the usual pattern is to keep non-secret settings in a version-controlled template and load secrets from a managed store. Confirm the exact loading order and file names against the PyRIT documentation for the version you run.
Security and operational risks in PyRIT configuration
PyRIT reads credentials from a plaintext file and settings from a second file, and it stores every conversation it runs. The cards below cover where that exposes keys, where it exposes test content, and where team setups drift apart. Each one names a check to run before PyRIT touches a production target.
Plaintext credential exposure
PyRIT reads endpoint credentials from ~/.pyrit/.env, so any key written there sits in plain text on disk. Anyone who can read that file, or who copies a project folder that contains a .env file, can call the target with your key. Check that .env files are excluded from version control and backups, that file permissions restrict reads to the owning user, and that rotation is part of the team's routine.
Shared workstation leakage
On a shared machine, the home directory holds one .pyrit_conf and one .env for whoever ran PyRIT last. A second analyst can inherit another person's target endpoints, keys, and memory database without noticing. Confirm that each analyst runs under a separate OS account or home directory, and clear credentials from shared hosts once a session ends.
Sensitive content in memory records
PyRIT memory stores conversations and results in SQLite or Azure SQL, and red teaming records include harmful prompts and the target's unsafe replies. A memory file on a laptop or a database with broad read access exposes that material long after the test ends. Decide the retention period, restrict who can query the database, and set a deletion step in your test close-out procedure.
Configuration drift between analysts
When each analyst edits their own .pyrit_conf, targets, scorers, and default settings diverge, and two people testing the same system get different results. Keep one reviewed configuration template in version control, store only placeholders and secret references in it, and record which version each test run used so findings can be reproduced.
Private vulnerability reporting
If you find a flaw in PyRIT itself, such as a way its configuration handling exposes credentials, do not open a public issue. The project asks for private reports through the Microsoft Security Response Center under its security policy. Record that path in your team runbook, and include the PyRIT version you tested so the maintainers can reproduce the issue.
PyRIT on GitHubHow DeployOpen works on this
DeployOpen plans and builds the PyRIT configuration a team shares, including the .env and .pyrit_conf files, database choice, initializers and labels. We work inside your own workstations, CI runners or servers, so the configuration matches how your team actually runs red teaming and passes your security review.
How we scope
- Inventory which targets, scorers and memory stores each team member needs before any file is written
- Agree in writing which configuration files, locations and loading order the deliverable covers
- Confirm the database choice between SQLite and Azure SQL against your data handling and access requirements
- Define which credentials stay in local files and which move to a managed secrets store, with owners named
- Engagements are fixed-scope, with deliverables and timelines agreed before work starts, and ongoing support available as a retainer
How we build
- Write the
.envand.pyrit_conftemplates with placeholders so no secret values enter source control - Set up
.gitignorerules and a pre-commit check that blocks accidental commits of credential files - Configure initializers and labels so team members see the same targets and naming conventions
- Test each configuration on a clean machine to confirm the loading order behaves as documented
- Check the pinned PyRIT version and Python version against the supported range before setup is locked
How we hand over
- Deliver a setup guide covering first-run steps, file locations and the loading order for each machine type
- Document each configuration key, its owner, and which values change between individuals and shared environments
- Provide a runbook for rotating credentials and updating configuration when the PyRIT version changes
- Walk the team through the configuration with their security and platform engineers so reviewers can follow it
- Hand over the repository, templates and documentation in your own infrastructure and version control
How we support
- Review configuration changes when new team members join or when targets and scorers are added
- Update templates and documentation when PyRIT releases change configuration behavior
- Retest the setup after upgrades so the team can rely on it before running new assessments
- Offer ongoing support and continuous testing as a retainer, scoped in writing
- Confirm support boundaries, response expectations and upgrade responsibilities in the written scope

