How Entra ID groups control who can reach CoPyRIT
A shared CoPyRIT server only works if the people who need it can reach it and the people who should not change it cannot. CoPyRIT checks Entra ID group membership at the application level, and it uses a separate admin group to gate the backend configuration routes. Application access is controlled by the group IDs listed in ENTRA_ALLOWED_GROUP_IDS, while configuration changes require membership in the group set as adminGroupObjectId. Teams that run one shared instance across several red teamers, or that mix operators who run attacks with leads who manage targets and settings, need this split. A single red teamer on a workstation usually does not, because local mode with no Entra settings is enough and keeps the server off the network.
The check depends on the tenant and client settings ENTRA_TENANT_ID and ENTRA_CLIENT_ID, plus the allowed and admin group object IDs. CoPyRIT asks Entra ID for the signed-in user's groups through the delegated Microsoft Graph User.Read permission and the /me/checkMemberGroups call, so the backend only sees the user's own memberships. Confirm before go-live that the app registration grants this delegated permission, that consent is in place for your tenant, and that the group object IDs come from the correct tenant. The PyRIT infrastructure README for v1.1.0 documents these settings. DeployOpen configures the tenant, app registration, group assignments and Azure environment inside your own accounts, and it records who holds each group so access can be reviewed later.
Plan the group design before you set the variables. Keep the admin group small and separate from the operator group, and confirm that nobody in the admin group is also expected to reach the server only through a route they should not have. Decide who approves group membership changes and how often the lists are reviewed. Also decide what happens when all three Entra variables are unset: CoPyRIT then disables authentication and allows every request, and setting only some of them stops startup with an error. Treat any environment where the variables are missing as open to anyone who can reach it, and confirm the network exposure described in your deployment before relying on group checks alone.
How a CoPyRIT request passes the group checks
The flow starts in the browser, where a user signs in to CoPyRIT through Microsoft Entra ID. The backend then asks Entra ID, using delegated User.Read and /me/checkMemberGroups, which groups the signed-in user belongs to. It first checks membership against allowedGroupObjectIds for application access. Configuration routes require a second check against adminGroupObjectId. Confirm that the admin group is a subset of the allowed groups in your design, and that the backend, not the browser, makes both group checks.
Sign-in, group lookup and the two authorization checks in CoPyRIT.
Choosing between open, group-gated and admin-separated modes
This mode applies when ENTRA_TENANT_ID, ENTRA_CLIENT_ID and ENTRA_ALLOWED_GROUP_IDS are all unset. CoPyRIT then skips Entra ID checks and allows every request, which suits a single red teamer working on a workstation with the server bound to localhost. It is the fastest way to start, but it removes the only identity check the application has, so anyone who can reach the port can run attacks and read stored results.
- Who it fits: one operator on a personal machine, or a short test run where nothing sensitive is stored.
- What it exposes: every route, including configuration routes, is open to any caller that reaches the server.
- Trade-off: setup is minimal, but no audit trail ties actions to a person.
- Network dependency: the safety of this mode depends entirely on network controls outside CoPyRIT.
- Startup behavior: setting only one or two of the three variables is a startup error, so partial configuration cannot silently fall back to open mode.
Before relying on this mode, confirm with your own environment that the server is not reachable from other hosts, and that no shared database or stored target credentials are present.
In this mode all three variables are set, and CoPyRIT checks that each signed-in user belongs to a group listed in allowedGroupObjectIds. Group membership is read through the delegated Graph User.Read permission and the /me/checkMemberGroups call, so access follows the Entra groups your identity team already manages. This suits a shared team instance where everyone who runs red team campaigns holds the same role.
- Who it fits: a red team or product security group where all members need the same capabilities.
- What it exposes: the application itself, for any member of an allowed group, including all attack and configuration routes unless an admin group is defined.
- Trade-off: onboarding is controlled by group membership, but every allowed member has the same configuration power.
- Identity dependency: removing a user from the group removes access, so group hygiene becomes part of the security control.
- Multiple groups: list each permitted group object ID, so separate teams can share one instance without granting access to every group.
Confirm with your identity team that the group object IDs are correct, that membership changes are reviewed, and that the app registration grants the Graph permission the backend needs.
This mode adds adminGroupObjectId on top of group-gated access. Members of the allowed group can use CoPyRIT for red teaming, while only members of the admin group can reach backend configuration routes. It limits the people who can change how the instance connects to targets, stores secrets or alters settings, which matters once several testers share one deployment.
- Who it fits: shared instances where a small platform or security owner manages configuration and a larger group runs tests.
- What it exposes: the testing surface to the allowed group, and the configuration surface only to the admin group.
- Trade-off: a clear separation of duties, at the cost of a second group to maintain and a role some testers may find restrictive.
- Audit value: configuration changes can be traced to a small, named set of administrators, which supports review.
- Admin membership: keep the admin group small and confirm that admins are also in an allowed group if they need to run tests.
Before go-live, test one account from each group in a non-production instance to confirm that configuration routes are refused for testers and allowed for admins.
Configuration settings and when each fits
This table compares the five Entra ID settings that control CoPyRIT access and the delegated Graph permission the backend uses to check group membership. Read each row for what the setting does, what breaks if it is wrong or missing, and the point at which the choice matters most. The main takeaway is that the application gate and the admin gate are separate settings, so a user can pass sign-in and still be refused configuration routes.
| Setting | Role | If wrong or missing | When the choice matters |
|---|---|---|---|
| ENTRA_TENANT_ID | Identifies the Entra tenant that issues sign-in tokens for CoPyRIT users. | If set alone, CoPyRIT fails at startup. If it points at the wrong tenant, legitimate users cannot sign in. | Matters in multi-tenant or partner setups, and wherever a separate instance serves a different organization. |
| ENTRA_CLIENT_ID | Identifies the app registration that CoPyRIT uses for sign-in and token validation. | If set alone, startup fails. If it refers to a registration without the expected redirect and permission setup, sign-in breaks. | Matters when each team instance has its own app registration, so the wrong ID can send a team into another team's instance. |
| ENTRA_ALLOWED_GROUP_IDS | Lists the group object IDs whose members may use CoPyRIT at all. | If left unset while the other two are set, startup fails. If a group is missing, its members are refused. If a broad group is listed, too many people gain access. | Matters most for least-privilege access, because this is the main gate for every red teamer who opens the GUI. |
| allowedGroupObjectIds | The name in the CoPyRIT authorization configuration that corresponds to the application access list, holding group object IDs rather than display names. | Using group names instead of object IDs, or leaving the list empty when auth is on, blocks access or leaves the gate ineffective. | Matters when a group is renamed or recreated, since object IDs remain the reliable reference. |
| adminGroupObjectId | Identifies the single group whose members may reach backend configuration routes. | If it is left out, admin routes are unavailable to everyone. If it is set to a broad group, ordinary red teamers can change backend configuration. | Matters when more than one person needs to change settings, and when deciding whether admin operations are allowed at all. |
| Delegated Graph User.Read with /me/checkMemberGroups | Lets the backend ask Graph which groups the signed-in user belongs to, on the user's own behalf. | If not granted or not consented, the backend cannot confirm group membership and users are refused or the check fails. | Matters at onboarding of a new tenant and after any app registration change, since consent is easy to miss. |
Setting up the tenant, client and group IDs
This sequence confirms the Entra tenant and app registration behind CoPyRIT, collects the object IDs for the access and admin groups, grants the delegated permission the backend needs, sets the authentication variables, and proves each group behaves as intended with test accounts.
Confirm the Entra tenant and app registration
The identity owner for your Entra tenant confirms which tenant CoPyRIT will trust and which app registration will represent the CoPyRIT application. Record the tenant ID and the application (client) ID, and confirm that the registration is the one intended for this CoPyRIT instance and not a shared or test registration. Confirm the exact portal navigation against the infra README for v1.1.0 before you click through, because menu labels can differ by tenant configuration. Done when you have both IDs written down and someone other than the author has checked them against the registration overview page.
Collect the group object IDs
Identify two security groups in Entra: one for users allowed to open CoPyRIT, and a separate, smaller group for administrators who may change backend configuration routes. Copy the object ID of each group, not its display name, since the backend matches on object IDs. Keep the two groups distinct so that access to the application does not automatically grant configuration rights. Done when you have two object IDs, each labeled with its purpose, and you have confirmed that the admin group ID is different from the access group ID.
Grant delegated User.Read to the app
In the app registration, add the delegated Microsoft Graph permission User.Read so the CoPyRIT backend can call the /me/checkMemberGroups endpoint on behalf of a signed-in user. This is a delegated permission, not an application permission, so the check runs in the context of each user. Confirm the permission type in the API permissions view and confirm whether your tenant requires administrator consent before it becomes active. Done when the permission appears as delegated with the expected consent state, and you have noted who gave consent.
Set the three ENTRA variables together
Set ENTRA_TENANT_ID, ENTRA_CLIENT_ID and ENTRA_ALLOWED_GROUP_IDS in the environment that runs the CoPyRIT backend, using the values from the earlier steps. Set all three in the same change. If only some are set, startup fails, and if all three are unset, authentication is disabled and every request is allowed, so this step must not be left half done. Then set the admin group ID for the configuration routes in the variable the infra README names for v1.1.0. Done when the backend starts cleanly with all values present and the startup log shows authentication enabled.
Test with a member account
Sign in to CoPyRIT with a test account that belongs to the allowed access group but not the admin group. Confirm that the application loads and that the red teaming workflows are available. Confirm also that configuration routes are refused for this account. Record the account type, the result and the time of the test. Done when the member can use the application and is denied the admin-only configuration routes.
Test with a non-member account
Sign in with a test account that is not in the allowed access group. Confirm that CoPyRIT refuses access and does not show any application content. Check the backend log for the denied authorization decision so you know the check ran and did not fail silently. Done when the non-member is blocked at the application level and the log records the denial.
Test with an admin account
Sign in with a test account that belongs to the admin group. Confirm that it reaches the configuration routes that the member account was refused. Then confirm that this account can also use the normal application, since admin rights are checked separately from application access. Done when the admin account passes both checks and the results match the group design you documented.
Security risks in group-based CoPyRIT access
Entra group gating is simple to configure but easy to weaken in small ways. The cards below cover the mistakes that most often leave a CoPyRIT instance open, over-privileged or out of step with who is on the red team, and the control to apply to each.
Leaving auth unset on a server
When ENTRA_TENANT_ID, ENTRA_CLIENT_ID and ENTRA_ALLOWED_GROUP_IDS are all unset, CoPyRIT auth is disabled and every request is allowed. A backend started this way on a networked host is open to anyone who can reach it. Check that all three variables are set in every environment that listens on a network address, and treat an unset value in a deployed config as a failed review item.
CoPyRIT infra READMEAdmin and standard users in one group
CoPyRIT separates application access (allowedGroupObjectIds) from backend configuration routes (adminGroupObjectId). If the same Entra group fills both roles, every red teamer who can run attacks can also change backend configuration. Keep the admin group small, populate it deliberately, and confirm that the allowed group list does not double as the admin list.
Membership drift across teams
Red teamers move between projects, and group membership often lags behind. A person who left a team can keep access to a shared instance, while a new member can be blocked until someone notices. Review group membership on a fixed schedule and assign each allowed group to a named owner who approves additions for that CoPyRIT instance.
Partially set variables blocking startup
Setting only some of the three Entra variables is a startup error, so a half-finished change can stop the service during a deployment. Teams often respond by removing variables to get the app running, which silently turns auth off. Keep the three values in one reviewed configuration source and validate them together in the deployment pipeline rather than editing them one at a time.
Over-broad Graph permissions
The backend uses delegated Graph User.Read with the /me/checkMemberGroups call to check membership. Granting broader Graph permissions than this check needs gives the app reach beyond its purpose. Confirm the app registration requests only the delegated User.Read permission and re-check the grant after any change to the app registration.
Offboarding that misses CoPyRIT
Removing someone from the corporate directory does not always remove them from the group list CoPyRIT relies on, particularly when group object IDs are copied into several instances. Keep a record of which allowed and admin group IDs each instance uses, and include every CoPyRIT deployment in the offboarding checklist so access ends in all of them.
Running group access after go-live
The most important habit after go-live is reviewing who is in the groups named by allowedGroupObjectIds and adminGroupObjectId, because CoPyRIT only checks membership at sign-in through the delegated /me/checkMemberGroups call. Group membership is owned by your identity team, so the red team lead cannot see changes made in Entra ID unless someone schedules a review. Set a recurring review with the owners of both groups, confirm that the admin group stays small and contains only people who should change backend configuration, and record who approved each membership. Confirm with your Entra administrators how often memberships are reviewed under your own access review policy, and whether group-based access reviews can be used for these two groups.
Test every change to an allowed or admin group in a separate instance before it reaches production. A non-production CoPyRIT with its own app registration and group IDs lets you confirm that a test user who is added to the allowed group can sign in, that a user outside the group is refused, and that a user in the allowed group but not the admin group cannot reach configuration routes. Because removing someone from a group takes effect on their next check, verify removals as well as additions. Keep the test group separate from production groups so test accounts never receive production access. Illustrative example: a red teamer moves to a partner team, and you confirm their sign-out and refusal in the test instance before you change the production group.
Group changes apply to every CoPyRIT instance that reads the same group IDs, so a shared group used across several deployments changes access in all of them at once. Check which deployments reference each group before you edit it. Separate team instances created with deploy_instance.py each need their own group settings, so review them one by one. Local servers started with pyrit_backend are a different case: when the three Entra variables are unset, authentication is disabled and every request is allowed, so a local server does not follow Entra group changes at all. Confirm that local servers stay bound to the workstation, and that no one has pointed a remote CLI at a local backend expecting group checks to apply.
Limits to confirm in your environment
The Entra group gate depends on tenant settings, Graph behavior and the PyRIT version you deploy, and none of these are fully visible from the code alone. Confirm each item with the people who own your identity tenant, your network and your red team before you rely on group membership as the control.
Delegated Graph permission policy
CoPyRIT uses the delegated User.Read permission and calls /me/checkMemberGroups to check membership. Some tenants restrict user consent or require admin consent for delegated permissions, so the app registration may be blocked or may need a tenant administrator to approve it. Ask your Entra administrator whether consent for this permission is allowed for the app registration, and who approves it.
Nested group membership
Group checks through /me/checkMemberGroups can behave differently for nested groups, dynamic groups and groups synced from on-premises directories. A user who appears to be in an allowed group in the portal may not pass the check, or the reverse. Ask your identity team which group types your red team uses and test one nested and one direct member before you go live.
Admin route behavior in your version
The adminGroupObjectId setting controls backend configuration routes, and the exact set of routes it protects can change between PyRIT releases. Read the route list for the version you deploy, then confirm with a non-admin test account that each configuration route returns a refusal. Record the version and the test result for your change file.
Token lifetime and sign-out
Group membership is evaluated when a token is issued or checked, so a user removed from a group may keep access until their session or token expires. Ask your identity team what token lifetimes, conditional access sign-in frequency and revocation steps apply to your tenant. Agree with the red team lead how quickly removed members must lose access.
Fail-open configuration risk
When the tenant, client and allowed group settings are all unset, CoPyRIT auth is disabled and every request is allowed. Setting only some of them causes a startup error. Ask your platform team to add a deployment check that confirms all three values are present in each environment, and to alert on any environment that starts without them.
Interaction with network exposure
Group checks only protect requests that reach the application. If the app is reachable from networks outside your intended scope, or if a local server is started on a shared host, group membership does not limit who can connect at the network layer. Ask your cloud and network team which ingress paths reach the instance and whether private access is required.
Questions teams ask before configuring CoPyRIT access
What does it cost to set up CoPyRIT access control with Entra ID groups?
Cost depends on the written scope, and DeployOpen does not publish a price list. Effort is driven by how many Entra groups and app registrations you need, how complex your tenant is (multiple tenants, guest users, conditional access policies, existing naming rules), and how many CoPyRIT instances must be gated separately. Each instance needs its own tenant, client and group ID values, so instance count multiplies the verification work. Most of the setup is one-time: creating the app registration, mapping groups and testing sign-in. Changes that come later, such as new team members or group moves, are usually handled by your team in Entra. Ask for a quote that lists each instance, each group, the test cases and what your team must supply.
How long does a typical CoPyRIT Entra group configuration take?
No fixed duration applies, because the time depends on your tenant and on the number of groups and instances involved. The configuration steps themselves are short. Much of the elapsed time usually goes to approvals: admin consent for the app registration, sign-off from group owners and change windows in your environment. Testing adds time because each group should be checked with a member, a non-member and an admin account, and the checks should be repeated after any change. Ask for a timeline in the written scope that separates steps DeployOpen controls from steps that depend on your approvals. Treat any duration you hear before the tenant has been reviewed as an estimate that still needs to be confirmed.
What does our internal team need to provide before configuration starts?
Before work starts, your team needs to provide the following:
- Tenant access with rights to register an application and consent to its delegated permissions, or a named administrator who will do it.
- An owner for each Entra group used in the application access list and the admin group, so every membership change has an accountable person.
- Test accounts: at least one member of the application group, one non-member and one admin group member, in a non-production tenant or in clearly labelled accounts.
- Confirmed tenant ID, client ID and group object IDs, plus the environment where CoPyRIT will run.
- A decision on who approves membership changes after go-live.
The list grows if your tenant uses conditional access rules, guest users or group naming policies, so confirm those early.
Can our own engineers configure CoPyRIT Entra group access from the infra README?
Yes, a team with tenant administration experience can follow the CoPyRIT infra README for the release, provided it understands three things: the difference between the application group and the admin group, the delegated Graph User.Read permission used by the /me/checkMemberGroups check, and how the server behaves when variables are partially set. The README is the primary source for variable names and permissions, so confirm you are reading the version you deploy. Teams that do it themselves usually benefit from a reviewer who did not make the configuration, because misconfigured admin groups tend to surface only when a user reports a problem. DeployOpen can deliver the configuration, verification and written evidence as a scoped piece of work.
What breaks if one of the Entra variables is missing?
The outcome depends on which variables are missing. If ENTRA_TENANT_ID, ENTRA_CLIENT_ID and ENTRA_ALLOWED_GROUP_IDS are all unset, CoPyRIT authentication is disabled and every request is allowed, which is the most dangerous state for a server that people on your network can reach. If only some of the three are set, the server fails at startup, so a partial configuration is at least visible during deployment. The main risk is a value that disappears silently, for example when a deployment script drops it or an environment change removes it. Add a check to your deployment pipeline that confirms all three values are present in the running environment, and test a user outside the allowed group before you announce access. Test the admin group separately, because a correct application group does not show whether configuration routes are limited to the right members.
Why does CoPyRIT need a separate admin group for configuration routes?
Using the application at all and changing its configuration are different privileges. The allowed group controls who can use CoPyRIT, while the admin group controls access to backend configuration routes, so a red teamer who runs attacks does not need the ability to change server settings. Keep the admin group small, limited to platform owners, and separate from team groups. Confirm with a test that a member of the application group can use the normal features but is refused on configuration routes. Review admin membership on a schedule your security team sets, since this group holds the most sensitive capability in the deployment. Record who approved each admin member so the access decision can be explained to an auditor later.
How does DeployOpen scope CoPyRIT access control work in writing?
Most DeployOpen engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. For this topic, the written scope should list the tenant and each CoPyRIT instance covered, the application group and admin group with their owners, the app registration and delegated Graph permission, the verification cases to run and the evidence delivered, such as configuration records and test results. It should also name what your team provides and which approvals sit outside DeployOpen's control. A quote follows from that written scope, and DeployOpen does not publish a price list. If you need continuing support for new groups, a new instance or periodic membership reviews, these can be covered under a retainer.
How DeployOpen scopes and supports CoPyRIT access control
DeployOpen plans and implements CoPyRIT access control inside the client's own Azure tenant and infrastructure. The work starts with a written scope that maps Entra ID groups to user access and admin configuration, then builds, tests and documents the setup so the client's identity and security teams can review it.
How we scope
- Confirm which Entra tenant, app registration and user groups will gate CoPyRIT access
- Separate who may sign in from who may change backend configuration routes before any build starts
- Agree in writing which group object IDs, Graph permissions and sign-in tests are in scope
- Record the decision on whether local or unauthenticated modes are allowed for any environment
How we build
- Configure the tenant ID, client ID and allowed group IDs for the CoPyRIT deployment
- Set the admin group object ID and confirm that only admins reach configuration routes
- Grant the delegated User.Read permission the backend needs for group membership checks
- Test that non-members, members and admins each receive the expected access result
How we hand over
- Deliver a written record of tenant, client and group IDs with their owners and purpose
- Document the startup check that fails when only some Entra settings are provided
- Provide test cases showing allowed, denied and admin-only requests with observed results
- Hand over runbooks for adding users, rotating groups and reviewing admin membership
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing first
- Ongoing support, upgrades and continuous testing are available as retainers
- Retesting after group changes, CoPyRIT upgrades or identity provider changes can be included in scope
- Ask any partner to confirm how access evidence will be retained for your own compliance reviews

