Provision a User with a Role
A 5-step recipe with Apache Airflow. We can help you get access.
Recipe · 5 steps
Provision a User with a Role
with Apache Airflow
Create a role if needed, then create a user assigned to it and verify.
- List the deployment's permission catalog so the role's action and resource names are drawn from what this Airflow actually offers rather than guessed.
- Look the role up by name. A 200 means it already exists and the user can be bound straight to it; a 404 means it must be created first. Both are expected outcomes.
- Create the role with the requested action/resource pairs before any user is attached to it.
- Create the user with the role attached at creation time, so the account never exists in an unintended permission state.
- Read the user back and require the account to be active, returning the roles Airflow actually recorded against it.
What you'll need to have ready
- roleName: The role to bind the user to (e.g. "PipelineViewer").
- roleActions: The action/resource pairs granted to the role when it must be created, each shaped as {"action": {"name": "can_read"}, "resource": {"name": "DAGs"}}. Valid name
- username: The login name for the new user.
- email: The user's email address, which must be unique in the deployment.
- firstName: The user's given name.
- lastName: The user's family name.
- password: The initial password. Airflow stores it hashed and never returns it on read.
For your developer
Arazzo workflow apache-airflow:provision-user, 5 operations: get_permissions → get_role → post_role → post_user → get_user. Specs on APIs.io.