Azure Data Factory | Web Activity

Abhay Chandramouli 966 Reputation points
2023-03-24T06:42:20.22+00:00

Hi

I want to get a token from graph api using the Web Activity

The token request is a multipart/form data type

I am unable to send data in this format

Let me know the steps for this

We are using graph api from documentation
User's image

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,541 questions
0 comments No comments
{count} vote

Accepted answer
  1. MartinJaffer-MSFT 26,026 Reputation points
    2023-03-24T20:13:45.74+00:00

    @Abhay Chandramouli Hello and welcome to Microsoft Q&A.

    I understand you need guidance to implement getting an auth token for graph API.

    Here is an example of how mine is set up. I use x-www-form-urlencoded, not form-data. The documentation I found for graph API also said to use x-www-form-urlencoded.

    For body:

    User's image

    As a whole:

    User's image

    For best practices, do not write the client_secret or id in the code. Instead, first create securestring parameters. This makes it so nobody can read the credentials in the parameters via monitoring.

    User's image

    Next, in the Web activity general, turn on Secure output and Secure input. This makes is so nobody can see the credentials in the Web activity input, and nobody can see the token in the output. You can still use it though.

    User's image

    Now, to use the parameters in the body.

    grant_type=client_credentials&client_id=@{pipeline().parameters.cliend_id}&client_secret=@{pipeline().parameters.client_credentials}&scope=https://graph.microsoft.com/.default
    
    

    I accedentally named the parameter for "client__secret" as "client_credentials". But it should still work. You get the idea?


0 additional answers

Sort by: Most helpful