Azure data factory REST API throwing error

Vikas Tiwari 771 Reputation points
2021-10-29T04:51:23.067+00:00

I am trying to fetch data through data factory using REST API OAuth2ClientCredentails, but I am getting error : {"error_description":"access_denied","error":"server_error"}, where as its working through postman and able to fetch bearer token, also its working using basic auth.

Is there any data factory sample example using REST API OAuth2ClientCredentails flow?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,639 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MartinJaffer-MSFT 26,236 Reputation points
    2021-11-02T16:54:38.83+00:00

    My apologies for the delay @Vikas Tiwari . My home office had an internet outage.

    Below are taken from one of my proof of concept pipelines. In practice, it is terrible idea to hardcode the credentials. It is better to retrieve from KeyVault. The client Id might be called username, and secret called password, in some other system.

    Token Fetching URL:  
      
    https://login.microsoftonline.com/mySubscriptionId/oauth2/v2.0/token  
      
    Token Fetching Body:  
      
    grant_type=client_credentials&client_id=myCliendId&client_secret=myClientSecret=&scope=https://storage.azure.com/.default  
      
    Extract token from response expression:  
      
    @activity('Get Token').output.access_token  
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.