question

vshets-6686 avatar image
0 Votes"
vshets-6686 asked saldana-msft edited

Microsoft Authentication Library (msal) with Power Automate

I would like to generate new tokens (from Microsoft graph api) and reuse tokens (until they expire) using power automate. However I do not see any built in connectors to use msal. One solution is as below:

pZc2v.png

However as you can see, each time the table is modified, it generates a new token. I would like to avoid this step and instead use token cache until I am required to generate new token. I see that 3rd party libraries (python, c# etc) provide this capability. Given such libraries exist, how can I leverage them to securely generate and reuse tokens - do I have to create a custom connector and invoke a python script (utilizing msal lib) from Azure functions? If so, this looks a bit convoluted since MSAL is integral and part and parcel of MS, so I was hoping for more direct integration with a cleaner solution.


power-query-not-supportedmicrosoft-graph-identityazure-ad-msal
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Adding right tags/teams to assist.

0 Votes 0 ·
Ehren avatar image
0 Votes"
Ehren answered vshets-6686 commented

I'm not sure whether what you're trying to do is possible, but if it is you would likely need to write a custom connector. @MiguelEscobar-3907 may be able to provide more guidance.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yeah .. in the end I used azure function that does all the authentication and re use of tokens. Power automate connects to this az func via http connector. it works fine for now.

0 Votes 0 ·
MiguelEscobar-3907 avatar image
0 Votes"
MiguelEscobar-3907 answered

Hey!
I believe what you'll need is a Power Automate custom connector:
https://docs.microsoft.com/en-us/connectors/custom-connectors/define-blank

There's even this tutorial that can help you with creating that custom connector for Power Automate:
https://docs.microsoft.com/en-us/graph/tutorials/power-automate

In terms of MSAL vs ADAL, I believe you can create a custom connector that supports either.

Hope this helps!

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.