Microsoft Dynamics365 Business Central

Connecting to Dynamics 365 Business Central

To connect to data, specify OrganizationUrl. The OrganizationUrl should be either the endpoint to your business central account such as https://businesscentral.dynamics.com/abc123/, or it should reference the web services root. Please see Business Central Endpoints for more details on how to specify the OrganizationUrl and which endpoints are available.

If you have multiple companies in your organization, you must also specify the Company to indicate which company you would like to connect to. Company does not need to be specified if you have only one company.

User and Access Key Authentication

To authenticate to Dynamics 365 Business Central, you may provide the User and AccessKey connection properties. Microsoft recommends these for testing and development purposes, but discourages their use for production environments.

To obtain the User and AccessKey values, navigate to the Users page in Dynamics 365 Business Central and then click on Edit. The User Name and Web Service Access Key values are what you will enter as the User and AccessKey connection string properties. Note that the User Name is not your email address. It is a shortened user name.

OAuth Authentication

Microsoft recommends for production use cases to use OAuth authentication. Below is an explanation of how to connect via OAuth. OAuth requires the authenticating user to interact with Dynamics365. To connect, you will need to register an app in Azure. Below we list the steps on how to register an App on Azure.

Create an Azure App using the New Portal

  1. On the left hand side, select Azure Active Directory, then App Registrations and click the Add button.

  2. In the menu presented, give a name to your app, select app/web api

  3. set the CallbackURL to the appRulesPortal URL (example: http://localhost:8080)

  4. Now go to Keys and create a key for the app. You can select to create a key with a limited duration, or one that never expires. Selecting one that never expires will prevent you from having to create further keys in the future and is recommended.

  5. After the key is saved, a value for the key will be displayed once. Save this value or write it down. You will also need to save the value of the Application Id currently displayed.

  6. Now select required permissions and Add. Under Select an API, choose Business Central.

  7. Once the Dynamics365 app has been added to the required permissions, select it from the menu and under Delegated Permissions, select Access Business Central as organization users.

  8. Save your changes.

Authenticate to Dynamics365 in appRules Portal when creating a new datasource

Set the following connection properties:

  • OrganizationUrl: The organization url you are connecting to such as https://[organization].crm.dynamics.com.

  • OAuthClientId: Set this to the application id displayed for the app you created in Azure.

  • OAuthClientSecret: Set this to the value of the key you created in Azure.

Use the following process to Get your access and refresh tokens

The connector will use the refresh token to obtain a new access token once the current access token has expired. This is generally the best method of configuring OAuth.

Configuration PropertyValue

Initiate OAuth

REFRESH

OAuth Access Token

Set to the value of the OAuth access token obtained from the endpoint

OAuth Refresh Token

Set to the value of the OAuth refresh token obtained from the endpoint

Connect using MSI Authentication

If you are running Dynamics 365 Business Central on an Azure VM, you can leverage Managed Service Identity (MSI) credentials to connect:

  • AuthScheme: Set this to AzureMSI.

The MSI credentials will then be automatically obtained for authentication.

Other properties (Proxy...) are detailed in section common properties

Last updated