Airflow API Returns 403 Forbidden When Using Azure AD Authentication via Custom API Backend #47029
Replies: 6 comments 1 reply
-
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval. |
Beta Was this translation helpful? Give feedback.
-
that's an interesting discussion and maybe someone will be able to help, but I think expecting that somene will help with debugging your custom authentication is homestly I think a bit too much for people who are trying to help otehrs in their free time. Maybe somoene will help you to debug it, but unless you will distill it to something that will show that this is an airlfow and not your custom backend issue, you are mostly left to debugging your own code. |
Beta Was this translation helpful? Give feedback.
-
Converted it to a discussion. |
Beta Was this translation helpful? Give feedback.
-
@potiuk thanks for your comment. I just cannot understand how I can see error if custom api backed finished successfully. I mean, I expect if I follow needed syntax to use custom api backed and instead of any validation just put ‘pass’ it should works …so, |
Beta Was this translation helpful? Give feedback.
-
Hi @seniut airflow.cfg
my error logs
|
Beta Was this translation helpful? Give feedback.
-
Can reproduce the same issue, doesn't matter what I do, it's always 403, i created a new endpoint and made authorization via my custom requires_authentication and everything worked, however if I try to use it as a plugin - it doesn't work and return 403 |
Beta Was this translation helpful? Give feedback.
-
Apache Airflow version
2.10.5
If "Other Airflow 2 version" selected, which one?
2.10.4
What happened?
I deployed Airflow on Azure K8s (AKS) via the Airflow Official Helm Chart. For UI authentication I use Azure AD via OAuth2 for that I have Azure App Registration for handling AIrflow access via Role-based access control (RBAC). Everything works as expected.


There are a couple of settings in Azure App Registry:
API permissions:
there are permissions for access to UI through
Delegated
permission type andApplication
permission type to Airflow API access via custom API backend through Application URI ID (using as ascope
to fetch access token):So, I use a custom Airflow API backend to access Airflow and manage Roles via endpoint:
https://airflow-ui-test.westeurope.cloudapp.azure.com/auth/fab/v1/roles
. In values.yaml Helm chart file in env section I have:here is my custom API backend:
airflow_utility.dag_level_access_control.azure_ad_auth_backend
And I get error:
There is the custom Airflow API Backend:
I use
"verify_signature": False
because usingjwt.decode
function I get an every time error that the signature is invalid. If someone knows why and how to fix it, I would be glad to get any recommendations. But this isn't the main question.The main question is:
Why do I get the error above? I expect to have access if I use a custom API backend to validate the token. The gotten token includes claim
roles
(for mapping Airflow roles and App registration roles) as I useApplication
permission type in App registry API permissions.There are a couple of logs from API backend:
I get the same error:
using Postman and just pure python through GET request and {"Authorization": f"Bearer {access_token}"} in header
What you think should happen instead?
I expect that if I use the Airflow API backend I should have access to API if the backend code was passed.``
How to reproduce
deploy Airflow on AKS and use custom API backend to use Azure AD token.
Operating System
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
Versions of Apache Airflow Providers
airflow@airflow-webserver-7fdffbcd6b-cznnc:/opt/airflow$ pip freeze | grep apache-airflow-provider
apache-airflow-providers-amazon==9.2.0
apache-airflow-providers-celery==3.10.0
apache-airflow-providers-cncf-kubernetes==10.1.0
apache-airflow-providers-common-compat==1.3.0
apache-airflow-providers-common-io==1.5.0
apache-airflow-providers-common-sql==1.21.0
apache-airflow-providers-docker==4.0.0
apache-airflow-providers-elasticsearch==6.0.0
apache-airflow-providers-fab==1.5.2
apache-airflow-providers-ftp==3.12.0
apache-airflow-providers-google==12.0.0
apache-airflow-providers-grpc==3.7.0
apache-airflow-providers-hashicorp==4.0.0
apache-airflow-providers-http==5.0.0
apache-airflow-providers-imap==3.8.0
apache-airflow-providers-microsoft-azure==10.3.0
apache-airflow-providers-mysql==6.0.0
apache-airflow-providers-odbc==4.9.0
apache-airflow-providers-openlineage==2.0.0
apache-airflow-providers-postgres==6.0.0
apache-airflow-providers-redis==4.0.0
apache-airflow-providers-sendgrid==4.0.0
apache-airflow-providers-sftp==5.0.0
apache-airflow-providers-slack==9.0.0
apache-airflow-providers-smtp==1.9.0
apache-airflow-providers-snowflake==6.0.0
apache-airflow-providers-sqlite==4.0.0
apache-airflow-providers-ssh==4.0.0
Deployment
Official Apache Airflow Helm Chart
Deployment details
AKS, Official Airflow Helm Chart.
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions