Skip to content

From Entra groups and repository permissions to Snowflake roles

A person's access in Snowflake passes through four links, and each one is controlled somewhere different:

flowchart LR
  G["Entra group"] -->|"SCIM (Entra decides who)"| SR["Snowflake role, same name, owned by AAD_PROVISIONER"]
  FR["Functional role, e.g. ANALYST"] -->|"granted_to (repository)"| SR
  DR["Database roles, e.g. SANDBOX.CURATED_READ"] -->|"read / write (repository)"| FR
  P["Privileges on schemas, tables, views"] -->|"macro (repository)"| DR
  • Entra decides who is in which group, and so who holds which SCIM role.
  • The repository decides what each role can do.
  • GitHub, Azure and Snowflake permissions decide who can change the repository's effect. That is the last section, and the one security reviews ask about.

Entra groups to Snowflake roles (SCIM)

Not part of our verification

We haven't run SCIM provisioning in the verified setup. The steps below come from Snowflake's and Microsoft's documentation. Try it with one test group first.

In Snowflake, once per account

USE ROLE ACCOUNTADMIN;
CREATE ROLE IF NOT EXISTS AAD_PROVISIONER;
GRANT CREATE USER ON ACCOUNT TO ROLE AAD_PROVISIONER;
GRANT CREATE ROLE ON ACCOUNT TO ROLE AAD_PROVISIONER;
GRANT ROLE AAD_PROVISIONER TO ROLE ACCOUNTADMIN;

CREATE SECURITY INTEGRATION IF NOT EXISTS AAD_PROVISIONING
  TYPE = SCIM
  SCIM_CLIENT = 'AZURE'
  RUN_AS_ROLE = 'AAD_PROVISIONER';   -- case-sensitive, upper case

SELECT SYSTEM$GENERATE_SCIM_ACCESS_TOKEN('AAD_PROVISIONING');

The token is a bearer secret for creating users and roles in your account. Paste it straight into Entra, don't store it anywhere else, and note that it expires after six months. Provisioning stops when it does, so put the renewal in someone's calendar, or rotate it with the same pattern as the rotation guide.

In Entra

  1. Add Snowflake from the Entra application gallery as a new enterprise application. Snowflake says not to reuse an existing one.
  2. Provisioning → New configuration. Tenant URL is your account URL plus /scim/v2/, for example https://<org>-<account>.snowflakecomputing.com/scim/v2/. Secret token is the value from above. Test Connection, then Create.
  3. In Properties, turn on accidental-deletion prevention and quarantine notification emails.
  4. Keep the scope at assigned users and groups, and assign one group. Validate with Provision on demand before starting the full cycle.

What arrives in Snowflake

Entra Snowflake
An assigned group An account role named after the group's display name, owned by AAD_PROVISIONER
The group's members Users, owned by AAD_PROVISIONER, each granted that role
The user's userName (by default the UPN; check the attribute mapping) The user's NAME and LOGIN_NAME, unless you set MAP_SCIM_USERNAME_TO_ENTERPRISE_ATTR to make them differ
active = false (user unassigned or disabled) User disabled, not dropped
Optional extension attributes DEFAULT_ROLE, DEFAULT_WAREHOUSE, DEFAULT_SECONDARY_ROLES

How it behaves:

  • Membership changes arrive on the next sync cycle, about every 40 minutes. Activating a group membership through PIM for Groups arrives in 2 to 10 minutes, which makes just-in-time access to an admin role practical.
  • Nested groups aren't provisioned. Assign the groups whose members should get the role directly.
  • SCIM only manages what AAD_PROVISIONER owns. Hand-made users and roles are left alone, and existing users can't be moved under SCIM except by granting their ownership to AAD_PROVISIONER.
  • Name groups as Snowflake identifiers, for example SNOWFLAKE_FINANCE_ANALYSTS. The role takes the group's display name, and names with spaces or punctuation become quoted identifiers everyone has to type exactly.

Connect a SCIM role to the repository

The SCIM role gets no privileges of its own. Grant it a functional role:

roles:
  - name: ANALYST
    read: [SANDBOX.CURATED]
    granted_to: [SNOWFLAKE_FINANCE_ANALYSTS]   # the SCIM role

Granting a role needs ownership of the role being granted, which the project has, and nothing on the SCIM role. So the project never manages or alters the SCIM role, and the two systems don't fight over it.

SCIM and External OAuth together

If you also use on-behalf-of sign-in, SCIM's LOGIN_NAME is exactly what External OAuth maps tokens to. That's what you want for most people, but check administrators. A SCIM-provisioned user who also holds ACCOUNTADMIN would carry it into application sessions through secondary roles, the problem the OBO guide's separate _APP user solves. With SCIM, do the inverse: keep the SCIM-provisioned user for everyday work, and give administrator roles to a separate administrator user, or grant them only just in time through a PIM-managed group.

Repository definitions to role privileges

What each part of the manifest produces, using the reference macros:

In manifest.yml Statements it generates Effect
databases[].name define database The database exists and the project owns it. Removing the entry drops it with its data.
databases[].schemas[] define schema ... with managed access, plus two database roles <SCHEMA>_READ: usage, select on all and future tables and views. <SCHEMA>_WRITE: _READ, plus create table/view and insert, update, delete, truncate.
roles[].name define role, grant role ... to role <role_parent> A functional role, rolled up to role_parent (SYSADMIN).
roles[].read grant database role <DB>.<SCHEMA>_READ, grant usage on database Read access to those schemas
roles[].write grant database role <DB>.<SCHEMA>_WRITE, grant usage on database Read and write access to those schemas
roles[].granted_to grant role <role> to role <each> Everyone holding those roles (SCIM or hand-made) gets the functional role

To see what a role can do in practice, without reading the macros:

SHOW GRANTS TO ROLE ANALYST;                          -- its database roles and USAGE
SHOW GRANTS TO DATABASE ROLE SANDBOX.CURATED_READ;    -- the privileges behind them
SHOW FUTURE GRANTS IN SCHEMA SANDBOX.CURATED;         -- what new tables will get
SHOW GRANTS OF ROLE ANALYST;                          -- who holds it

All four are metadata and need no warehouse.

Who can change a role's access

Whoever can change any link above controls Snowflake access, whatever their Snowflake role. Treat each row as a privileged position:

Holds Can do in Snowflake Control it with
Write access to the repository Open a pull request, which runs a plan as SVC_DCM_PLAN. Can't deploy. Can run its own code on the runner. Limit write access; ephemeral runners
Merge rights to main Deploy anything: merging runs the deploy as DCM_ADMIN Branch protection, required reviews, CODEOWNERS on manifest.yml, sources/, .github/
Permission to run workflows Re-run a deploy of what's already on main (manual dispatch) Optional required reviewers on the snowflake-dcm environment
Repository admin Change branch protection or the environment's branch policy, and so bypass review Few admins; audit log alerts
Azure rights on the managed identities' resource group Add a federated credential that trusts another repository or branch, which then deploys as DCM_ADMIN Restrict Managed Identity Contributor and Owner on that resource group
Group owner in Entra Add people to a group, and so to its Snowflake role, within about 40 minutes Group ownership reviews; PIM for privileged groups
Application admin in Entra Change the SCIM app's scope and mappings Entra role assignments
DCM_ADMIN (SECURITYADMIN, ACCOUNTADMIN) in Snowflake Deploy outside the repository, or change grants by hand Few holders; a scheduled plan of main shows drift

Two practical rules follow:

  • Review CODEOWNERS and branch protection like you review SECURITYADMIN grants. Merging to main is granting.
  • Let people raise access by pull request. A request to add someone's team role to a functional role's granted_to is a one-line diff, reviewed by the data owner listed in CODEOWNERS, and recorded in Git history.

Next: Adopting it incrementally.