Manage Access Packages¶
The engineer's guide to managing privileged personas. Use this runbook to:
- Create a privileged persona: its group, roles, PIM settings and access package.
- Change a persona's grants, PIM settings or package.
- Run the Tier 0 commands CI posts, and apply the Tier 1/2 packages.
- Register new directory roles or Tier 0 RBAC scopes, or adjust user caps, in the allow-list.
- Expand the operator's ABAC condition to permit new Azure RBAC assignments.
For why it works this way, see Access Packages 101.
What is a persona?
A persona is a bundle of admin permissions for one job, like managing Azure Policy. The permissions belong to a group, not to people. You request access to the group, and once approved, you switch the permissions on yourself for a limited time using PIM when you need them.
The projects¶
| Project | Who applies | Holds |
|---|---|---|
azure-privileged-access |
Tier 0 items: a PIM-elevated person, from commands CI posts. Tier 1/2 packages: CI on main (manual play) |
Every persona (pag-t*.tf), the requestor and approver groups (sg-t*.tf), PIM settings (pim-settings.tf), access packages (access-packages.tf) and the Tier 1/2 catalog (catalogs.tf). Terraform creates nothing and keeps no state: these are lists. |
solution-privileged-access-allowlist |
Release tag on merge | The allow-list: directory roles, Tier 0 RBAC role+scope pairs, eligibility caps, and the operator persona's ABAC condition. |
solution-manage-pag-persona v3 |
Release tag on merge | One persona: looks its group up and outputs what it should be and what it is granted. |
azure-privileged-access-packages |
— | Retired and archived (2026-12-04). Everything it held now lives in azure-privileged-access. |
azure-privileged-access was called azure-privileged-access-grants until 2026-12-04. Its identities keep the old name (sp-pla-tf-privileged-access-grants-ro / -rw), because renaming an identity replaces it.
Before you start¶
- Persona name:
t<n>-<verb>-<scope>(e.g.t1-policy-defender). It names the group (pag-<persona>), the file (pag-<persona>.tf) and the package title ((tier <n>) <Title>). - Tier:
t0,t1ort2. It decides the requestor and approver groups (sg-t<n>-*) and which catalog the package goes in. See Determine an Access Package's Tier. - Roles and scopes: every directory role and Azure RBAC grant. Tier 0 ones must be in the allow-list, and every RBAC role must be in the operator's ABAC condition.
- To run the posted commands: Windows PowerShell 7 with
Microsoft.Graph.Authenticationinstalled, the Azure CLI, and eligibility for the(tier 0) Privileged Access Grantspackage. Activatingpag-t0-privileged-access-grantsgives Privileged Role Administrator and Identity Governance Administrator, which covers every note.
Create a persona¶
📁
azure-privileged-access: 📃pag-<persona>.tf,grants-outputs.tf,pim-settings.tf,access-packages.tf
-
Copy a persona file of the same tier and change the name, description and grants. Example,
pag-t2-reader-mg-platform.tf:module "pag-t2-reader-mg-platform" { source = "git::https://gitlab.com/grinntec-cloud/terraform-modules/terraform-solutions/solution-manage-pag-persona.git?ref=v3.0.0" # The solution prefixes this persona name with "pag-" to form the Entra ID group name. persona_name = "t2-reader-mg-platform" description = "Reader at mg-platform and all child subscriptions." # RBAC grants for this persona. rbac_grants = { reader-mg-platform = { scope = data.azurerm_management_group.platform.id role_definition_name = "Reader" } } # Marks the Entra ID group as role-assignable. role_assignable = true # Owners of the Entra ID group for this persona. group_owners = local.tier_0_group_owner_ids }A Tier 0 grant takes its role from the allow-list (
module.allow_list.allowed_rbac_grants["<key>"].role); directory roles always do (directory_role_template_ids). -
Add the module to
local.personasingrants-outputs.tf. A persona missing from that list gets no grants. - Add the group to
local.pim_settingsinpim-settings.tf, e.g.{ max_activation = "PT8H", require_justification = false }. Every persona needs an entry, or the plan fails. - Add its package to
access-packages.tf:local.tier0_access_packagesfor Tier 0, orlocal.tier1_2_access_packages(withtier = 1or2) for Tier 1/2. - Tier 1/2 only: add the group to the Tier 1/2 catalog's groups in
catalogs.tf. Never put a Tier 0 group there: a check fails the plan. - Open an MR. Each job posts a note saying exactly what would change: check the new group, its grants, its PIM settings and its package, and nothing else.
Then run the posted commands.
Change a persona¶
📁
azure-privileged-access: the same files
Edit the list that holds the thing: the persona file for grants or description, pim-settings.tf for activation, access-packages.tf for the package, the sg-t* file for who may request or approve. Open an MR, read the notes, merge, then run the posted commands.
Removing a grant works the same way: delete it from the persona file and the note posts the removal command.
Run the posted commands¶
📁
azure-privileged-access: the merge request's notes, or the jobs onmain
A note that needs you starts with "Tier 0 change: admin required". It says when to run it, which PIM group to activate and what each command does.
- In MyAccess / PIM, activate
pag-t0-privileged-access-grants. - In Windows PowerShell 7, run the notes in this order, copying each block as posted:
- Privileged groups: creates missing groups and fixes descriptions, owners and members. The others need the groups.
- Role grants and Directory role grants.
- PIM settings.
- Catalog setup.
- Tier 0 access packages.
- Run a new pipeline on
main. Every job should post nothing: Entra and Azure now match the code.
If a command fails with 403 on Microsoft.Authorization/roleAssignments/write, the role isn't in the operator's ABAC condition: see Manage what roles can be assigned.
A new group's PIM settings may 404 at first
The first PIM change to a group onboards it to PIM for Groups, and Entra gives it a new policy. The posted command retries and re-reads the policy ID, so wait for it to finish.
Apply the Tier 1/2 packages¶
📁
azure-privileged-access: jobaccess-packages-tier-1-2
- On the MR, the job lists what
mainwill change. Check it. - After merge, open the
mainpipeline and press play onaccess-packages-tier-1-2. It signs in assp-pla-tf-privileged-access-grants-rw, which holds only Access package manager on the Tier 1/2 catalog. - It worked when the job ends green and a new pipeline's job lists nothing.
If it fails because a group isn't in the catalog, run the Catalog setup note first: the pipeline identity can't add groups to a catalog.
Manage the allow-list¶
📁
solution-privileged-access-allowlist: 📃entra-directory-roles.tfor 📃rbac-grants.tf
This project is the policy contract for the privileged access model. It holds no state and deploys nothing: it is the allow-list of Entra directory roles, Tier 0 Azure RBAC role+scope pairs, and each one's maximum number of eligible users. Merging a feat: or fix: commit tags a new release, which azure-privileged-access pins in allow-list.tf.
Use this project when you need to:
- Add a directory role
- Add a Tier 0 RBAC role+scope pair (e.g. at
tenant rootormg-intermediate-root) - Change a
max_eligible_userscap
Info
If a persona references a role or scope that is not defined here, the azure-privileged-access
plan fails with:
Info
Only Tier 0 grants need to be in the allow-list. Tier 1/2 grants name the role directly.
Tier 0 grant - takes the role_definition_name from the allow-list
rbac_grants = {
management-group-contributor-mg-tenant-root = {
scope = data.azurerm_management_group.tenant_root.id
role_definition_name = module.allow_list.allowed_rbac_grants["management-group-contributor-mg-tenant-root"].role
}
}
Tier 1/2 grant - uses the role_definition_name value directly
-
📁
solution-privileged-access-allowlist: 📃entra-directory-roles.tf# Can perform common billing related tasks like updating payment information. "billing-administrator" = { role_template_id = "b0f54661-2d74-4c50-afa3-1ec803f12efe" max_eligible_users = 5 }- Take the role name and template ID from Microsoft's Entra built-in roles reference.
- Set
max_eligible_usersto a sensible number to limit how many people can hold the package.
-
📁
solution-privileged-access-allowlist: 📃rbac-grants.tf"management-group-contributor-mg-tenant-root" = { scope_management_group = "<tenant root management group id>" role = "Management Group Contributor" max_eligible_users = 3 }- Name the block
<role>-<scope>; personas inazure-privileged-accessreference it by that key. - Keep the scope as small as possible.
- Take the role name from Microsoft's Azure built-in roles reference.
- Set
max_eligible_usersto a sensible number.
- Name the block
-
Commit as
feat:(e.g.feat: allow billing-administrator). The release job only tagsfeat:/fix:commits; anything else merges with no new version. Merge, then confirm the new tag exists under Code → Tags. - In
azure-privileged-access, bumprefinallow-list.tfto the new tag.
Manage what roles can be assigned¶
📁
solution-privileged-access-allowlist: 📃locals.tf
When pag-t0-privileged-access-grants is active, Azure only lets it assign and remove the roles listed in operator_group_roles in locals.tf, and only to groups. This is an ABAC condition on its Role Based Access Control Administrator assignment at the tenant root. Without it, the operator could assign any role to anyone.
Follow this procedure when you want to give a persona an Azure RBAC role (not an Entra directory role: that's the allow-list) that the operator isn't allowed to assign yet. Otherwise the posted az role assignment command fails with a 403 saying the ABAC condition is not fulfilled for Microsoft.Authorization/roleAssignments/write (or /delete when removing one).
The condition is part of the operator's own role assignment, and the operator can't change its own permissions. So this takes two rounds:
Round 1: update the operator's condition.
Add the role to operator_group_roles and release the allow-list. In azure-privileged-access, bump the allow-list ref. Don't add the new grants yet. Merge. The Role grants note posts one change: the operator's RBAC Administrator assignment with the new condition. Run it with two groups active: (tier 0) Privileged Access Grants and (tier 0) Owner at Tenant Root. Deactivate Owner at Tenant Root as soon as it finishes.
Round 2: add the grants (normal). Add the persona's new grants, merge, and run the note with only (tier 0) Privileged Access Grants active. If it works, the new condition is doing its job.