Microsoft Dynamics 365 Business Central App Registration with Azure for OAuth2.0 Authentication

Summary

This article describes the step-by-step process of registering Microsoft Dynamics 365 Business Central application with Azure Active Directory, generating theAccess token & configuring the account in webMethods.io Integration.

Prerequisites

  • The user needs to have a working Microsoft Azure Active Directory and a Microsoft Dynamics 365 Business Central License to access the API.
  • Working webMethods.io Integration cloud tenant.

Contents

  1. Create and Configure the App in Microsoft Azure Active Directory
  2. Generate the Access_token and Refresh_token using the REST Client.
  3. Configuring the Microsoft Dynamics 365 Business Central account in webMethods.io Integration.

Steps

1. Login to Azure Portal (Use the same credentials as your Dynamics 365 Business Central).

2. Once you have logged in, navigate to the option “Azure Active Directory” and click on “App registration”.

3. Click on “New registration

4. Add the Necessary information for the App, like “Name”,” redirect URL” and click on Register.

Supported Account types: - Users can choose from the options, based on their needs. For more information about the supported scopes click on “Help me choose…”

In the URL field enter the URL using which you need to obtain the OAuth authentication token in response to the request from the URL (In my case I am going to useURL: https://www.softwareag.com/en_corporate.html). Users can use any accessible URL for ex:http://www.google.comor any other.

5. It will take a few seconds and create an application for you. Please note down the Application ID, you will need it when connecting to Dynamics 365 Business Central using OAuth.

6. Click on API Permissions, it will show all the available permission. Users can add more required permissions by clicking on the “Add a permission” button.

7. Select the API “Dynamics 365 Business Central” from the API Listing menu and click on that.

>
Note: In case the user wants to use Microsoft "PAID" offerings, the user needs to get the License to use the desired Microsoft APIs for the tenant.

8. Select all the available permission in the wizard, Delegated as well as Application permissions (if available), and click on the “Add permission” button.

9. After selecting all the necessary permissions, the user needs to click on the “Grant admin consent” button. Click on “Yes” to grant admin consent.

10. Users can also generate the “client_secret” via the below-mentioned process.

  • Click on Certificates and Secrets and then click on New Client Secret.
  • Choose the desired time duration for your secret key, click on the Add button.
  • Your Client secret will be generated. Store it for use during Access Token generation.

11. Now We have done all the necessary settings, that we require to generate the Access_token. We will use the “Postman” client to generate the Access_token. Set up a GET call request with the base URL as below.

GET https://api.businesscentral.dynamics.com/v1.0/api/v1.0

12. In the Authorization tab Select OAuth 2.0 as the Type and Click on “Get New Access Token”

13. Fill in all the details mentioned below and click on “Request Token”

  • Token name: choose a descriptive name.
  • Grant type: choose the Authorization Code.
  • Callback URL: specify the URL specified as the Redirect URI in the Azure Portal.
  • Auth URL: specify a URL such as

https://login.windows.net/<your tenant domain>/oauth2/authorize?resource=https://api.businesscentral.dynamics.com.

  • Access Token URL: specify a URL such as

https://login.windows.net/<your tenant domain>/oauth2/token?resource=https://api.businesscentral.dynamics.com.

  • Client ID: enter the Application ID from the registered app in Azure Portal.
  • Client Secret: Enter the Client Secret generated in Step 10.
  • Client Authentication: choose the“Send client credentials in the body”option.

14. Now, we have generated the Access_token and Refresh_token successfully. We will configure the Microsoft connection to webMethods.io Integration.

15. User needs to log in via the webMethods.io credentials and choose the Microsoft Dynamics 365 Business Central Connector.

>
Note: Business Central is available only on Flowservices as it contains stream related operations.

16. Click on “Add custom operation” and then the “+” icon in the following tab. Users can choose the predefined operations and then Configure the account if required.

17. Users can enter all the required details and Click on “Add” to save the Account successfully.