skip to Main Content

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.
enter image description here

Tried basic-auth with my azure credentials, but did not work.
How do I authenticate Azure Data Factory Managed Airflow from postman?

2

Answers


  1. 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:-

    enter image description here

    Rest API output With Basic Auth with AAD credentials:-

    enter image description here

    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:-

    enter image description here

    Called the airflow API with the access token above but received the same error:-

    enter image description here

    Tried calling the airflow with curl request but it gave the same error:-

    Curl:-

    curl -X GET 'https://xxxxxxxxxxxxxx.uksouth.airflow.svc.datafactory.azure.com/api/v1/connections?limit=100'  -H 'Content-Type: application/json'  --user "username:password"  -d '{ "is_paused": true }'
    
    

    enter image description here

    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:-

    enter image description here

    Copy the Request URL and pass it in your Browser > Log in with your AAD credentials and receive the response like below:-

    enter image description here

    Get the same API request in redoc and call it in your browser like below:-

    enter image description here

    Now, I created a new Airflow managed service in ADF with Basic auth and called the API in Postman with Basic Auth like below:-

    enter image description here

    Called Airflow API with basic auth credentials in Postman and received the desired response like below:-

    enter image description here

    enter image description here

    enter image description here

    With curl:-

    curl -X PATCH 'https://xxxxxxxxxxxxx.uksouth.airflow.svc.datafactory.azure.com/api/v1/connections?limit=100'  -H 'Content-Type: application/json'  --user "username:password"  -d '{ "is_paused": true }'
    
    

    enter image description here

    Login or Signup to reply.
  2. 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

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search