Microsoft Authentication Library (msal) with Power Automate

vshets 96 Reputation points
2021-02-27T01:53:13.773+00:00

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.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,825 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,511 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,831 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ehren (MSFT) 1,781 Reputation points Microsoft Employee
    2021-03-17T21:29:11.327+00:00

    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. @Miguel Escobar may be able to provide more guidance.


  2. Miguel Escobar 326 Reputation points
    2021-03-17T21:40:05.177+00:00

    Hey!
    I believe what you'll need is a Power Automate custom connector:
    https://learn.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://learn.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!

    0 comments No comments