I have an Airflow instance in Azure Data Factory.
I can test the APIs from swagger.
But when I try to test from postman, it’s showing authentication error.
Tried basic-auth with my azure credentials, but did not work.
How do I authenticate Azure Data Factory Managed Airflow from postman?
As, Azure ADF Airflow feature is still in preview, There’s no direct Rest API to call managed airflow service in ADF refer below:- How does Managed Airflow work? – Azure Data Factory | Microsoft LearnIn order for API to work you need to select Basic auth by entering username and password while creating Airflow with ADF.
When I used AAD as an authentication, Even I received the same error code as yours and got Sign in Page in the Postman output like below:-
Created Airflow1 with AAD as auth type:-
Rest API output With Basic Auth with AAD credentials:-
Generated access token with client credentials flow using service principal client ID and secret and called the API but only got sign in page in response refer below:-
GET https://login.microsoftonline.com/<Tenant-ID>/oauth2/v2.0/token
client id:<Client-Id>
tenant id:<tenant-Id>
client secret:<client-secret>
scope:https:management.azure.com/.default
grant_type:client_credentials
Generated access token:-
Called the airflow API with the access token above but received the same error:-
Tried calling the airflow with curl request but it gave the same error:-
At the moment, REST APIs for ADF Managed Airflow only work if your Airflow instance was created with Basic Auth. This means when you create your ADF Managed Airflow instance, select "Basic Auth" and enter your own username/password and used that when calling REST APIs for your Airflow instance
ADF Managed Airflow REST APIs with AAD Auth is currently not supported
2
Answers
As, Azure ADF Airflow feature is still in preview, There’s no direct Rest API to call managed airflow service in ADF refer below:-
How does Managed Airflow work? – Azure Data Factory | Microsoft Learn In order for API to work you need to select Basic auth by entering username and password while creating Airflow with ADF.
When I used AAD as an authentication, Even I received the same error code as yours and got Sign in Page in the Postman output like below:-
Created Airflow1 with AAD as auth type:-
Rest API output With Basic Auth with AAD credentials:-
Generated access token with client credentials flow using service principal client ID and secret and called the API but only got sign in page in response refer below:-
Generated access token:-
Called the airflow API with the access token above but received the same error:-
Tried calling the airflow with curl request but it gave the same error:-
Curl:-
If you want to call the airflow rest API with AAD auth, You can directly call the HTTP API in your Browser and get the desires response like below:-
Called the API in Swagger UI:-
Copy the Request URL and pass it in your Browser > Log in with your AAD credentials and receive the response like below:-
Get the same API request in redoc and call it in your browser like below:-
Now, I created a new Airflow managed service in ADF with Basic auth and called the API in Postman with Basic Auth like below:-
Called Airflow API with basic auth credentials in Postman and received the desired response like below:-
With curl:-
At the moment, REST APIs for ADF Managed Airflow only work if your Airflow instance was created with Basic Auth. This means when you create your ADF Managed Airflow instance, select "Basic Auth" and enter your own username/password and used that when calling REST APIs for your Airflow instance
ADF Managed Airflow REST APIs with AAD Auth is currently not supported