How to add admin user in airflow ?
I want to use simple Web Authentication. If I add user as described in documentation airflow.apache.ort/security then user is not an admin.
code from docs:
import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
user.username = 'new_user_name'
user.email = '[email protected]'
user.password = 'set_the_password'
session = settings.Session()
session.add(user)
session.commit()
session.close()
exit()
If you are using the rbac
UI, the easiest option is to run the following command for Airflow <2 :
airflow create_user \
--email EMAIL --firstname firstname \
--lastname lastname --password password \
--role Admin --username username
For Airflow > 2:
airflow users create \
--email EMAIL --firstname firstname \
--lastname lastname --password password \
--role Admin --username username
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With