Forum Discussion
Airflow Jobs
- 1 year ago
Hi ArielSubia ,
You are facing the error because Azure AD is rejecting the OAuth request because the redirect URI you are using is not registered in their Entra ID app registration.Go to Azure Portal > Microsoft Entra ID > App registrations.Open the app used for PowerShell login (or the default Power BI client app if not using a custom one).Go to Authentication.Under Redirect URIs, click Add a platform > Mobile and desktop applications.Add the URI exactly which is used in your script.Enable Allow public client flows under Advanced settings.Save changes.Retry your Connect-PowerBIServiceAccount command in PowerShell.The authentication should now succeed without AADSTS500113.
Thank you.
Hi ArielSubia ,
You're hitting the reality of Fabric Airflow - it's more limited than your local setup, but there are good workarounds for your API-to-dashboard workflow.
For your folder structure issue: Since Fabric only accepts individual .py files, you need to flatten your project:
- Put all your reusable functions in a single utilities.py file
- Import those functions in your DAG files
- Use Fabric's environment variables for configuration instead of config files
For API data storage: Your JSON files can go directly into OneLake (Fabric's data lake):
# In your Airflow DAG
from fabric.lakehouse import LakehouseClient
def store_api_data():
# Get your API data
json_data = call_your_api()
# Write to lakehouse
lakehouse = LakehouseClient("your-workspace", "your-lakehouse")
lakehouse.upload_file(json_data, f"api-data/file_{datetime.now()}.json")Better approach - skip files entirely: Instead of storing JSON files, write directly to Delta tables in your lakehouse:
import pandas as pd
def api_to_delta():
api_response = call_your_api()
df = pd.json_normalize(api_response)
# Write directly to Delta table
df.to_delta("abfss://workspace/lakehouse/Tables/api_data")For the notebooks/pipelines part: Once data is in your lakehouse, trigger Fabric notebooks from Airflow using the Fabric REST APIs or set up event-driven triggers when new data lands.
The key is treating Fabric as a unified platform rather than trying to replicate your local folder structure.
What kind of API are you working with? That might affect the best storage approach.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.
- ArielSubia1 year agoFrequent Visitor
Hi burakkaragoz
Thank you for your answer!
I was trying to store the json files in my lakehouse. This lakehouse is located in the same airflow-job- workspace.
But, when I want to run my DAG, I have 2 DAG Import Errors in Airflow UI.
Broken DAG: [/opt/airflow/dags/data_dag.py]
Traceback (most recent call last): File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/opt/airflow/dags/data_dag.py", line 6, in <module>
from fabric.lakehouse import LakehouseClient
ModuleNotFoundError: No module named 'fabric'I was looking for the solutions in the documentation y wasn't able to solve it. I tried to add several packages in 'requirements.txt' but the issue continues.
Do you know how to solve it?
I would appreciate your help.
Thanks in advance!