Skip to content

Airflow API Returns 403 Forbidden When Using Azure AD Authentication via Custom API Backend #47029

Answered by seniuts-b2
seniuts-b2 asked this question in General
Discussion options

You must be logged in to vote

So, here’s a summary of the steps I took to make the setup work successfully. It can be valuable for someone else. But feel free to share with me better solution.

Env variables:

AAD_TENANT_ID = os.getenv("AAD_TENANT_ID")
AAD_CLIENT_ID = os.getenv("AAD_CLIENT_ID")
AAD_CLIENT_SECRET = os.getenv("AAD_CLIENT_SECRET")
# Airflow API Configuration
AIRFLOW_BASE_URL = "https://{{ your Airflow URL }}/auth/fab/v1"
# Azure AD OAuth2 Token URL
AUTH_URL = f"https://login.microsoftonline.com/{AAD_TENANT_ID}/oauth2/v2.0/token"
# Required permission scope for Airflow API
SCOPE = (
    f"api://{AAD_CLIENT_ID}/.default"
)
# Azure AD OAuth2 Token URL
TOKEN_URL = f"https://login.microsoftonline.com/{AAD_TENAN…

Replies: 7 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@potiuk
Comment options

potiuk Feb 24, 2025
Collaborator

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ChahatKumar
Comment options

Answer selected by seniuts-b2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug This is a clearly a bug area:API Airflow's REST/HTTP API area:auth area:core needs-triage label for new issues that we didn't triage yet
6 participants
Converted from issue

This discussion was converted from issue #47025 on February 24, 2025 15:50.