Reputation: 101
We want to use ADF to pull data from a REST API service. However the service uses OAuth and needs an access token to be passed.
Would you know if this is possible using ADFv2 ? If yes how ?
Upvotes: 0
Views: 1114
Reputation: 42063
I suppose you want to call the Azure REST API
in the ADFv2, if so, you could use Web activity in Azure Data Factory
.
You have not mentioned which REST API you want to use, here is a sample for you to refer.
In my sample, we call the api Virtual Machines - List
to list all the VMs in the specified resource group.
1.The web activity does not support bearer token auth, we need to use MSI auth in this case. Navigate to your subscription 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. More details see this link. Note your account need to be an Onwer
of the subscription to do this step.
2.In the pipline of your ADFv2, create a web
activity. Set the settings as below.
The URL
is https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines?api-version=2019-03-01
, change the parameters to yours. Select the Authentication
with MSI
, the Resource
is https://management.azure.com/
. Note the resource depends on the specific api you want to call.
3.Publish it and test it, it works fine on my side.
Upvotes: 1