Aman
Aman

Reputation: 11

How to authenticate my Logic App Dynamics F&O connection with API Connection

I am working on a logic app which needs to get data from Dynamics F&O. I am using Get action for Dynamics F&O but I cannot use Sign in method or Service Principal due to some reason. I rather store my service principal Client ID and Secret in an API Connection which is in my Logic App.

My question is, how should I connect to using that API Connection which has Client ID and secret for my service principal or should I have to use some other task to achieve this or get data from Dynamics F&O

Upvotes: 1

Views: 658

Answers (1)

vijaya
vijaya

Reputation: 1731

You can use the API Connection that you created to connect to Dynamics F&O. To authenticate with the API Connection, you can use the HTTP action in your Logic App. Here are the steps to do so:

  • Refer this azure active directory token document to register your logic App with Azure active directory and to get bearer token. enter image description here Then in your logic App workflow,
  1. Add an HTTP action to your Logic App.
  2. In the HTTP action, set the Method to POST.
  3. Set the URI to https://login.microsoftonline.com/{tenant-id}/oauth2/token, where {tenant-id} is the ID of your Azure AD tenant.
  4. In the Headers section, add the following key-value pairs:
  • Content-Type: application/x-www-form-urlencoded
  • Authentication type: Active Directory OAuth

enter image description here

  • Then in you can connect to Dynamic F&0 get records action by providing connection name, client id, client secret and tenant details as taken in http action. enter image description here

  • As mentioned in this @ AMREEK SINGH blog after http action you can also use parse Json action.

    In the Parse JSON action, set the Content to the output of the HTTP action. Then you can take Get records action of F&O. Refer this SO and MS document it may helps.

Upvotes: 1

Related Questions