How to Create OAuth Credentials for Microsoft Dynamics 365 Business Central

This guide will help you set up your Microsoft Dynamics 365 Business Central OAuth app to connect with Apideck and start using the Accounting API.

Prerequisites

Before you begin, make sure you have:

  1. A Microsoft developer account - Sign up at Microsoft Developer
  2. Access to the Microsoft Entra admin center with at least Cloud Application Administrator permissions
  3. An Apideck account

1. Enable the Microsoft Dynamics 365 Business Central connector in Apideck

  1. Navigate to the Apideck Dashboard
  2. Go to Configuration > Accounting > Microsoft Dynamics 365 Business Central
  3. The connector will be available for configuration

2. Create OAuth App in Microsoft Entra

Access Microsoft Entra Admin Center

  1. Log in to the Microsoft Entra admin center as at least a Cloud Application Administrator
  2. If you have access to multiple tenants, use the Settings icon in the top menu to switch to the tenant in which you want to register the application from the Directories + subscriptions menu
  3. Navigate to Home > App registrations and select New registration

Create new app

Configure Basic Information

On the Register an application page, enter your application's registration information:

  1. Name - Enter a meaningful application name that will be displayed to users of the app

  2. Supported account types - Select Accounts in any organizational directory and personal Microsoft accounts

  3. Redirect URI - Enter exactly https://unify.apideck.com/vault/callback

  4. When finished, select Register

register new app

Add API Permissions

After your app is created, select API permissions in the sidebar.

  1. Select Add a permission > Dynamics 365 Business Central > Delegated Permissions and choose:

    • user_impersonation
    • Financials.ReadWrite.All
  2. Select Add a permission > Dynamics 365 Business Central > Application Permissions and choose:

    • app_access
    • AdminCenter.ReadWrite.All
    • API.ReadWrite.All
    • Automation.ReadWrite.All

Delegated permissions

  1. Grant admin consent for the permissions by clicking Grant admin consent for [Your Organization]

Grant admin consent

Get Your Credentials

Get Client ID

  1. On the Overview page of your app, locate the Application (client) ID
  2. Copy the Client ID - you'll need this for Apideck configuration

Copy client ID

Create Client Secret

  1. Go to Certificates & secrets > Client secrets and select New client secret

Create new secret

  1. Enter a description and select an expiry time. Client secret lifetime is limited to two years (24 months) or less. You can't specify a custom lifetime longer than 24 months

Secret expiry

IMPORTANT: After the secret is generated, you'll see both a Secret ID and a Value.

  • Copy the VALUE only - this is what you'll use as your Client Secret in Apideck
  • The Value is shown once and cannot be retrieved after you leave this page
  • Do not use the Secret ID - that's different from the Value you need

Copy client secret value

3. Configure the Microsoft Dynamics 365 Business Central connector in Apideck

  1. Navigate to the Microsoft Dynamics 365 Business Central connector configuration in the Apideck Dashboard
  2. Select the Use your client credentials option
  3. Enter your OAuth credentials:
    • Client ID - Paste the Client ID from your Microsoft Entra app (from the Overview page)
    • Client Secret - Paste the Value of the client secret from your Microsoft Entra app
  4. Review that the scopes granted in Microsoft Dynamics 365 Business Central match with the scopes you are requesting in Apideck
  5. Click Save settings to save your credentials

Vault configuration

4. Test Your Connection

You can test your Microsoft Dynamics 365 Business Central connector by clicking Test Vault in the Apideck dashboard.

  1. Click Authorize to start the OAuth flow

Vault unauthorized

  1. You'll be redirected to Microsoft to grant permissions
  2. After successful authorization, select the Environment and Company ID from the dropdown and Save the changes
  3. The connection will show as Connected

Vault connected

5. Do your first API call to the Accounting API

  1. Connect through Vault
  2. Test with this call:
curl --location 'https://unify.apideck.com/accounting/customers' \
 --header 'x-apideck-consumer-id: test-consumer' \
 --header 'x-apideck-app-id: {APIDECK_APP_ID}' \
 --header 'x-apideck-service-id: microsoft-dynamics-365-business-central' \
 --header 'Authorization: Bearer {APIDECK_API_KEY}'

Now your app and Microsoft Dynamics 365 Business Central integration are configured! 🎉

FAQ and troubleshooting

Vendor Posting Group Error When Creating Bills

When creating a bill in Business Central with a supplier created through the API, you may encounter this error:

{
  "error": {
    "code": "Application_FieldValidationException",
    "message": "Vendor Posting Group must have a value in Vendor: No.=V00050. It cannot be zero or empty. CorrelationId: ..."
  }
}

This happens because Vendor Posting Group is a required field for vendors in Business Central, but it cannot be set through the API. Without it, the vendor cannot be used in bills.

To resolve this, you have two options:


Option 1: Set the Vendor Posting Group manually via the UI

  1. Open Business Central and navigate to Vendors.
  2. Select the vendor created via the API.
  3. On the Vendor Card, locate the Vendor Posting Group field.
  4. Assign the correct posting group and save.

Vendor Card with Vendor Posting Group field


Option 2: Use a Vendor Template with a predefined Posting Group

  1. In Business Central, search for Templates and create a new template.
  2. Fill in the following key fields:
    • Code: Give the template a code, e.g. VEND_API.
    • Description: Add a meaningful description, e.g. Template to add posting group.
    • Table ID: Select the vendor table.
    • Enabled: Make sure the toggle is switched on. Vendor Template with predefined Vendor Posting Group
  3. In the API Setup page, link this template so that vendors created via the API automatically inherit the posting group.

Vendor Template with predefined Vendor Posting Group

  1. Test by creating a new vendor through the API; the posting group should now be set automatically.

✅ By applying either of these methods, every supplier created through the API will have a valid posting group, allowing you to use them in bills without errors.