@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:
As a whole:
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.
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.
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?