There are two ways to trigger D365:
Way 1. Generate the Token
In this method, you generate the D365 token first and then use it to trigger D365.
Steps to Generate the Token:
1. Use the following URL:
https://login.microsoftonline.com/@{parameters('Tenant Id')}/oauth2/v2.0/token
2. Add the required Headers as below:
{ "Content-Type": "application/x-www-form-urlencoded" }
3. Use the following format in the body:
client_id=@{parameters('Client id')} &scope=@{parameters('D365URL')}%2F.default &client_secret=@{parameters('Client secret')} &grant_type=client_credentials
Once the token is generated, you can use it to trigger D365.
Expression:
{ "Authorization" : "Bearer @{body('Generate_D365_Token')?['access_token']}" }
The token remains valid for up to 1 hour, allowing you to reuse it for multiple triggers during this time.
Output:
Way2. Pass the Values Directly
In this method, you do not need to generate a token separately. Instead, you pass the Client ID, Client Secret, and Tenant ID directly in the same step.
If you are triggering D365 multiple times within a Logic App, you must pass these values for each step.
Keep Daxing!!
No comments:
Post a Comment