Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hi,
I am trying to find out how to run Airflow DAG via API call.
When I called an API from swagger UI page, it works properly. (using /connection api as example for simplicity)
However, if I called the same API from shell script or postman, it will always redirect me to microsoft login page.
Is there a way to authenticate using shell script or do I need to change airflow Configuration Overrides to allow basic authentication (if possible)?
Is it currently possible to run a DAG from a REST API call using basic authen or is there a way to authenticate using shell script ?
Hi @Anonymous
It seems like that AIRFLOWAPIAUTH_BACKEND is default to airflow.api.auth.backend.basic_auth (assuming if it is the same config as auth_backend)
I also tried to modify configuration overrides with
AIRFLOW__API__AUTH_BACKENDS : airflow.api.auth.backend.basic_auth
but it doesn't seems to work, I am not sure if I am doing it right.
I cannot find any document related to API setting for Fabric Airflow. Hope for more tutorial on this soon.
reference:
https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#auth-backends
Hi @saritboo
Modify the 'airflow.cfg' file to enable basic authentication. You need to set the 'auth_backend' to 'airflow.api.auth.backend.basic_auth'. This allows you to use basic authentication for API calls.
[api]
auth_backend = airflow.api.auth.backend.basic_auth
Ensure you have a user created in Airflow with the necessary permissions to trigger DAGs.
When making API calls from a shell script or Postman, include the 'Authorization' header with the base64 encoded username and password. Here’s an example using 'curl'
curl -X POST "http://your-airflow-url/api/v1/dags/your_dag_id/dagRuns" \
-H "Authorization: Basic $(echo -n 'username:password' | base64)" \
-H "Content-Type: application/json" \
-d '{"conf": {"key": "value"}}'
By following these steps, you should be able to authenticate and run Airflow DAGs via API calls without being redirected to the Microsoft login page
Here's the link for your reference:
API Authentication — apache-airflow-providers-fab Documentation
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.