Microsoft Dynamics 365 Business Central Using OAuth 2.0

Modified on Tue, 9 Sep at 5:14 PM


TABLE OF CONTENTS


Overview

Microsoft has deprecated Web Service Access Keys (Basic Auth) for Business Central Online, all implemented and new integrations must now transition to OAuth 2.0 for authentication. This guide outlines how to configure OAuth-based access between farmerswife and Business Central 365 (BC365).


This setup enables secure, token-based data exchange between the two platforms — designed for updating scheduling and personnel events.


Prerequisites

  • Access to Microsoft Azure portal with permissions to register applications.

  • Administrative access to Business Central 365.

  • farmerswife server version 7.1 or later.

  • A developer or IT contact who can run test calls using Postman or similar.


Step-by-Step Setup

1. Register an App in Azure Active Directory

To enable OAuth, start by creating or expanding an Azure App Registration:

  • Go to https://portal.azure.com/

  • Navigate to Azure Active Directory > App registrations

  • Click "New registration"

    • Name: farmerswifeAzureSync (or similar)

    • Supported account types: "Accounts in this organizational directory only"

    • Redirect URI: Not required for service-to-service calls

Once created:

  • Note down the Application (client) ID

  • Generate a Client Secret under Certificates & Secrets and note for later use the Client Secret Value.

Ensure this app has the following API permissions:

  • Dynamics 365 Business Central → Delegated or Application permissions:

    • Financials.ReadWrite.All

  • Microsoft Graph API → As required
    IMPORTANT if other farmerswife Azure / Entra ID integrations are already active and in use (e.g. the Exchange integration or the Entra ID Connector integration) these might already be configured to us the MS Graph API; in this case the existing App Registration needs to get expended as needed.


Still in Azure:

  • Under API permissions, click Grant admin consent.

3. Enable Business Central Web Services

In Business Central 365:

  • Ensure the necessary web services are published.

    • Go to Web Services in BC365

    • Publish the required pages/codeunits (e.g., employee exports, project updates)

  • Confirm the URL structure, which typically follows:

    https://api.businesscentral.dynamics.com/v2.0/{tenant-id}


4. farmerswife Configuration

On the farmerswife side:

  • Ensure you're running a fw version that supports OAuth (fw v7.1+).

  • Use the gathered Azure credentials (Client ID, Client Secret Value, Tenant ID) to configure the authentication settings.

  • Setup the integration endpoints in fw Server app > Setup > Users > Entra ID Connector for:

  • Client ID:

  • Client Secret Value:

  • Tenant ID:

  • OAuth2 Token: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token

  • Setup the "Navision" integration connection in the fw Client app > Long Form > Personnel tree icon click > Personnel Management > Exports > Navision Financials > Navision Exporter > Navision Settings window:  

  • Description: BC365
  • Server Name: https://api.businesscentral.dynamics.com/v2.0/{tenant-id}
  • Database Name: {environment}/WS/{company}
  • User Name: keep empty, legacy field, no longer in use
  • Password: keep empty, legacy field, no longer in use
  • Realm: keep empty, legacy field, no longer in use

5. Test the Integration

Use Postman or equivalent to simulate API calls:

  • Generate an OAuth 2.0 token using the Azure client ID and secret

  • Make authenticated GET/POST requests to BC365 Web Services endpoint

  • Verify successful 200 OK responses and data payloads

farmerswife also uses Postman internally to validate these credentials during development, so mirroring this process can help in troubleshooting.


Testing & Deployment

Once the configuration is complete:

  • Set up a test database/environment for end-to-end verification

  • Perform real-life workflows (e.g., creating vacation requests, syncing personnel data)

  • Validate correct data flow into BC365

After successful tests:

  • Schedule the production upgrade

  • Make sure all endpoints and authentication settings are updated in production

  • Inform users about any required local updates (e.g., desktop app reinstall, URL change)


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article