Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
saritboo
Frequent Visitor

DAGRun via API

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)

 

saritboo_0-1732612968057.png

 

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)?

 

saritboo_2-1732613126774.png

 

 

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 ?

2 REPLIES 2
saritboo
Frequent Visitor

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.

 

saritboo_0-1732681429480.png

 

I cannot find any document related to API setting for Fabric Airflow. Hope for more tutorial on this soon.

 

reference:

https://learn.microsoft.com/en-us/fabric/data-factory/apache-airflow-jobs-supported-apache-airflow-configurations

https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#auth-backends

Anonymous
Not applicable

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

API — Airflow 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.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Fabric Update Carousel

Fabric Monthly Update - October 2025

Check out the October 2025 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors