0

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

j.a.estevan
  • 3,057
  • 18
  • 32
Aman
  • 1
  • 3
  • did you tried anything. It would be great if you provide more details by adding images to your question. – vijaya Mar 21 '23 at 06:34
  • Yes, 1. I created API Connection to F&O after registering App.I have defined API Connection in Logic App. 2. I added, Get record from F&O Task to my Logic App 3. Then LA ask for authentication, I change LA code and put API connection rather then Service Principal or Signin – Aman Mar 21 '23 at 12:34

1 Answers1

0

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.

vijaya
  • 1,525
  • 1
  • 2
  • 6