Knowledge Base
Connecting to Dynamics 365 Business Central using an OAuth Token
Browse Common Categories
- Setting up a Dynamics CRM Connection
- Setting up a Dynamics CRM Connection
- Creating a Dynamics CRM Bulk Data Source
- Creating a Dynamics CRM Change Data Source
- Creating a Dynamics CRM Real-Time Data Source
- Setting up an Integration to Dynamics CRM
- Using an Entity Lookup
- Using an Entity Lookup
- Using an Activity Party
- Using a Multi Lookup
- Using a List Option Lookup
- Using a Relationship
- Using a MultiList Option Lookup
- Connecting to Dynamics 365 Business Central using an OAuth Token
- Creating a Dynamics 365 Business Central Bulk Data Source
- Creating a Dynamics 365 Business Central Change Data Source
- Creating a Dynamics 365 Business Central Real-time Data Source
- Setting up an Integration to Dynamics 365 Business Central
- Using an Odata Field Lookup
- Using an Entity Lookup
- Using an Activity Party
- Connecting to Dynamics 365 Customer Engagement using an OAuth Token
- Using a Relationship
- Using a List Option Lookup
- Using a Multi Lookup
- Setting up an Integration to Dynamics 365 Sales
- Creating a Dynamics 365 Sales Real-Time Data Source
- Creating a Dynamics 365 Sales Change Data Source
- Creating a Dynamics 365 Sales Bulk Data Source
- Setting up a Dynamics 365 Sales Connection
- Using an Entity Reference
- Creating a Dynamics CRM Bulk Data Source
- Creating a Dynamics CRM Change Data Source
- Creating a Dynamics CRM Real-Time Data Source
- Setting up an Integration to Dynamics CRM
- Using an Entity Lookup
- Using an Activity Party
- Setting up a Dynamics CRM Connection
- Using a Relationship
- Using a List Option Lookup
- Using a Multi Lookup
- Using an Entity Reference
- Using a MultiList Option Lookup
- Creating a REST Service Definition
- Adding a REST Service Connection
- Configuring OAuth2 Authentication
- Configuring Exchange Token Authentication
- Creating a Service Data Source Definition
- Adding a Bulk Service Data Source
- Configure Data Source Paging
- Creating a Service Destination Definition
- Setting up an Integration to a REST Service
- Creating a Service Lookup
- Configuring Service Entities for Data Sources
- Configuring Base Settings
- Using a Service Lookup
- Using Service Variables
- Using Error Handling
Connecting to Dynamics 365 Business Central using an OAuth Token
If your Dynamics 365 Business Central tenant is setup to authenticate with OAuth, follow the steps below to setup an OAuth token.
Setting up the application in Azure:
- Navigate to portal.azure.com
- Search for App registrations in the top search bar and select App registrations.
- Click New Registration and enter a name for the application.
- Choose the appropriate Supported Account Type, most companies will use “Accounts in this organizational directory only”.
- For the Redirect URI, choose Web and enter the correct URL based on deployment/region.
- This is specific to your SmartConnect region, so it will vary slightly depending on that. When setting up an Oauth Business Central connection, the redirect URL will be displayed in the connection window.
- Click Register.
- Click “Certificates & secrets” in the navigation on the left.
- Click “New client secret”.
- Give the secret a description and choose how long you want the secret to last. It is important to note that when the secret expires any connections using this secret will no longer connect successfully until a new secret is generated and used in the connection. Make sure to have a process in place for someone to create another secret and update any SmartConnect connections prior to the secret expiring in the future.
- Click Add to generate the new secret. Copy and save the Value somewhere as it will not be fully visible again once you navigate away from the Azure Portal.
- Click on “API Permission” in the navigation bar on the left.
- Click “Add a permission” and choose Dynamics 365 Business Central.
- Select Delegated permission if it is not already and enable user_impersonation and Financials.ReadWrite.All and click Add permissions.
- Click on Overview in the navigation bar on the left.
- Copy and save the “Application (client) ID” value.
- With the Application ID and the Secret Value copied and saved from the application setup, the BC connection in SmartConnect can now be configured.
- Login to login.smartconnect.com if not already.
- Navigate to Connections and click the Create Connection button (or edit an existing BC connection).
- Select Dynamics 365 Business Central OData.
- Enter a description for the connector and check the “Use OAuth to Connect” option.
- Note: The “Allow Long Timeout” and “Allow Retry of Failed Requests” options can also be checked, those options refer to enabling additional functionality within integrations using this connection.
- Enter your Service URL – this will be the base URL for OData services up to the /ODataV4/ portion of the URL (ie. https://api.businesscentral.dynamics.com/v2.0/<tenant-guid-here>/Production/ODataV4/). Your tenant GUID will be unique for each BC tenant/instance.
- The Tenant ID field should pull the GUID from the Service URL field if it was entered in a correct format.
- Enter the same Application Id (Client ID) from the application that was registered in the Azure portal. It can be found on the Overview page in Azure Portal.
- Enter the Client Secret value from the application, if the secret value was not saved when registering the application then a new secret and value will need to be created.
- Click Validate. This will start the OAuth process and you will be directed to a Microsoft login if not already logged in. If you were still logged in, you will be asked to grant permissions. Click accept to grant the permissions. If your user does not have the proper permissions, you will need to have an admin user grant the permissions.
- After successful validating you will be redirected back to the Dynamics 365 Business Central connector and can now choose your company.
- After successfully completing the validation and access steps, you can now save the connector.
If your Dynamics 365 Business Central tenant is setup to authenticate with OAuth, follow the steps below to setup an OAuth token.
Required SC version: 21.1.0.477 or higher
Setting up the application in Azure:
- Navigate to portal.azure.com
- Search for App registrations in the top search bar and select App registrations.
- Click New Registration and enter a name for the application.
- Choose the appropriate Supported Account Type, most companies will use “Accounts in this organizational directory only”.
- For the Redirect URI, choose Web and enter the correct URL based on deployment/region.
- When setting up an Oauth BC connection, the redirect URL will be displayed in the connection window.
- Click Register.
- Click “Certificates & secrets” in the navigation on the left.
- Click “New client secret”.
- Give the secret a description and choose how long you want the secret to last. It is important to note that when the secret expires any connections using this secret will no longer connect successfully until a new secret is generated and used in the connection. Make sure to have a process in place for someone to create another secret and update any SmartConnect connections prior to the secret expiring in the future.
- Click Add to generate the new secret. Copy and save the Value somewhere as it will not be fully visible again once you navigate away from the Azure Portal.
- Click on “API Permission” in the navigation bar on the left.
- Click “Add a permission” and choose Dynamics 365 Business Central.
- Select Delegated permission if it is not already and enable user_impersonation and Financials.ReadWriteAll and click Add permissions.
- Click on Overview in the navigation bar on the left.
- Copy and save the “Application (client) ID” value.
- With the Application ID and the Secret Value copied and saved from the application setup, the BC connection in SmartConnect can now be configured.
- Login to the SmartConnect app if not already.
- Navigate to Connections and click the Create button (or edit an existing BC connection).
- Select Dynamics 365 Business Central OData.
- Enter a description for the connection.
- Enter your Service URL – this will be the base URL for OData services up to the /ODataV4/ portion of the URL (ie. https://api.businesscentral.dynamics.com/v2.0/<tenant-guid-here>/Production/ODataV4/). Your tenant GUID will be unique for each BC tenant/instance.
- Check the “Use OAuth” option.
- The Tenant ID field should be the GUID from the Service URL field.
- Enter the same Application Id (Client ID) from the application that was registered in the Azure portal. It can be found on the Overview page in Azure Portal.
- Enter the Client Secret value from the application, if the secret value was not saved when registering the application then a new secret and value will need to be created.
- Click Verify. This will start the OAuth process and you will be directed to a Microsoft login if not already logged in. If you were still logged in, you will be asked to grant permissions. Click accept to grant the permissions. If your user does not have the proper permissions, you will need to have an admin user grant the permissions.
- Click the “Get Access Token” button to continue the validation process.
- Click the ellipsis button to pull a list of Companies and select one of them to complete the authentication process. The connection window can now be saved and closed.
Support