Binu V Pillai
Binu V Pillai

Reputation: 306

How to call a REST API using Azure Data Factory Pipelines?

I would like to execute a REST API with oauth authentication using ADF Pipeline. Without oauth2, I could call any REST APIs. So here my question is, does this ADF pipeline support REST APis with oauth2 authentication ? if yes. Please provide a solution

The API which is am trying, you can find from this URL https://learn.microsoft.com/en-us/rest/api/datafactory/pipelineruns/querybyfactory

Thanks
Binu

Upvotes: 5

Views: 27012

Answers (1)

Joy Wang
Joy Wang

Reputation: 42143

You could call the REST API with a Web activity in the pipeline, select the Authentication with MSI in the web activity.

enter image description here

Navigate to your subscription or ADFv2 in the portal -> Access control (IAM) -> Add -> Add role assignment -> search for the name of your ADFv2 and add it as an Owner/Contributor role in the subscription. Then the MSI of your ADFv2 will be able to call the rest api.

For exampple, my ADFv2 named joyfactory, just add the MSI with the same name as an Owner or Contributor.

enter image description here

After adding it, check it in the Role assignments , it should be like below.

enter image description here

For more details, check this similar issue.

Upvotes: 6

Related Questions