Forum Discussion
Airflow Job: Run a DAG using API
- 8 months ago
Hi mmmall,
Thank you for the response. Based on the screenshot here looks like the Fabric portal is calling the Airflow API using a session cookie, not a bearer token. Because of this internal authentication flow, it is not possible to reproduce the same call externally using a client-credentials token or any token we generate ourselves.
Currently fabric does not provide a public API to directly trigger a DAG inside an Apache Airflow Job, that is why your direct API calls fail even with a valid token.
The only supported approach is to trigger a Fabric item for example like a Notebook or Pipeline using the Fabric REST API and run the logic there.
Thanks and regards,
Anjan Kumar Chippa
Hello Anjan,
I did that before sending the previous message. The scope I see by decoding PowerBIAccessToken token is the one I've used (
Hi mmmall,
Thank you for the response. Even though the PowerBIAccessToken shows the power bi audience when you decode it, but this might not be the same token that the Fabric portal is actually sending to the Airflow API
This error with your token indicates that the token you generated is not valid for the Airflow resource. To get the correct audience, the only way is to capture the actual request the portal makes to the Airflow endpoint:
- Open Developer Tools --> Network
- Perform the action that hits the Airflow API like for example listing DAGs
- Find the actual request to the Airflow url and look at its Authorization header.
- Copy that token from that request’s Authorization header and decode it at jwt.ms
If you use this token, the Airflow API call will work the same way it does in the portal.
Thanks and regards,
Anjan Kumar Chippa
- mmmall9 months agoRegular Visitor
Hello Anjan,
Have you been trying out your proposed solutions, before proposing them - Do they work for you? Here if I try to do that, it apparently uses a Cookie instead, which is not a JWT decodable token.
- v-achippa8 months agoCommunity Support
Hi mmmall,
Thank you for the response. Based on the screenshot here looks like the Fabric portal is calling the Airflow API using a session cookie, not a bearer token. Because of this internal authentication flow, it is not possible to reproduce the same call externally using a client-credentials token or any token we generate ourselves.
Currently fabric does not provide a public API to directly trigger a DAG inside an Apache Airflow Job, that is why your direct API calls fail even with a valid token.
The only supported approach is to trigger a Fabric item for example like a Notebook or Pipeline using the Fabric REST API and run the logic there.
Thanks and regards,
Anjan Kumar Chippa
- mmmall8 months agoRegular Visitor
Hello Anjan,
Ideally we should be able to reach the Fabric Airflow Job through it's API directly by external apps, the workaround of using a Fabric Item that calls the API is a bit cumbersome.
- v-achippa8 months agoCommunity Support
Hi mmmall,
I understand the expectation. Currently fabric’s Airflow Job does not expose a public API so that external applications can call directly. The portal uses an internal authentication flow, which is why external requests cannot access the Airflow API.
Because of this current limitation, the only supported approach is to trigger a fabric item through the Fabric REST API and run your logic there. If direct external API access is added in the future, the documentation will be updated.
Thanks and regards,
Anjan Kumar Chippa