Skip to content

BC

Here, we set up access to BC, so that we can fetch data via API.

Set up BC Access with S2S Authentication (Cloud)

See here: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/automation-apis-using-s2s-authentication

  1. Get access to the relevant BC companies

  2. In Microsoft Entra ID, go to App registrations and create a new one

    1. name: Business Central Web Service Client
    2. Access by tenant only
    3. no URIs
  3. Request API Permissions API.ReadWrite.All, Automation.ReadWrite.All
    api-permissions.png

  4. Grant API Permission (or have it granted by an admin)
    grant-permission.png

  5. In BC, set up the application

    1. In the Business Central client, search for Microsoft Entra Applications and open the page.
    2. Select New > Microsoft Entra Applications Card opens.
    3. In the Client ID field, enter the Application (Client) ID for the registered application in Microsoft Entra ID from the previous step.
    4. Fill in the Description field.
    5. Set the State to Enabled.
    6. Assign permissions to the required companies (Important to have SUPER(DATA) for custom fields that need special permissions, D365 FULL ACCESS is enough for Postman access to the endpoints).
      bc-api-access.png
    7. Select Grant Consent (if you are Admin. Else, you can ask and admin to grant consent, or you can grant consent in the next step, from within Azure)
  6. In Azure

    1. If consent wasn't granted from within BC, grant it here.
      consent-granted.png
  7. In AAD

  8. For the App Registration, create a Client Secret
    client-secret.png

  9. In the Key Vault

    1. Create a client secret bc-api-clientsecret and set it to the value of the Client Secret created for the App registration
      vault-client-secret.png
  10. Test in Postman

    1. Configure tenant, client ID and client secret as Postman Variables
    2. Call Get Access Token
    3. Call "Get Companies" to be used for the SQL Config.Src_BC_Companies
      postman-companies.png
  11. Configure Src_BC_Companies.CompanyID
    dwh-bc-business-central-src-bc-companies.png

Set up BC Access with Basic Authentication (On Premise)

In the case of On Premise, we typically have Basic Authentication. In that case, you don't need an app.

Ask the client how to access the OData layer.

Some requirements are:

  1. You must be licensed

  2. Your user must be enabled

  3. Password Authentication must be enabled

  4. You must have the appropriate rights. For example, your user must have execute rights on the queries.

bc-access-basic-authentication.png

Check List BC Access

  • You can call the companies endpoint from BC
  • The table config.Src_BC_Companies contains all required companies
  • The table column config.Src_BC_Companies.BC_Id contains the IDs returned by the companies endpoint

Install Extension App

Prerequisite:

  1. You need to be in the Extension Mgt group

  2. You need to have a license other than Team, e.g. External Accountant

You install like so:

  1. Go to BC

  2. Search "Extension Management"

  3. Manage

  4. Upload Extension
    extension-management.png

  5. Browse file

  6. Accept privacy policy

  7. Deploy
    upload-app.png

Check List Extension App

  • The installation status in BC is Completed

Define BC Webservices

Query/Page Object ID Extension? Orig. Object ID Service Name
Query 50119 x pwrpvendors
Query 50120 x pwrpcustomers
Query 50107 x 25 pwrpCustomerLedgerEntries
Query 50102 x 263 pwrpVendorLedgerEntries
Query 50103 x 143 (Page) pwrpSalesInvoices
Query 50105 x 146 (Page) pwrpPurchaseInvoices
Query 50104 x 526 (Page) pwrpSalesInvoiceLines
Query 50106 x 529 (Page) pwrpPurchaseInvoiceLines
Query 50108 x 134 pwrpSalesCreditMemo
Query 50109 x 527 pwrpSalesCreditMemoLines
Query 501010 x 140 pwrpPurchaseCreditMemo
Query 501011 x 530 pwrpPurchaseCreditMemoLines
Query 50101 x 261 pwrpGLEntries
Page 77 Resources
Query 260 DimensionSetEntries
Query 2400 accounts

bc-installation-status.png

To verify the installation, call https://api.businesscentral.dynamics.com/v2.0/{{tenant}}/Production/ODataV4/Company('{{company_id}}')/pwrpSalesInvoiceLines in Postman.

Check List BC Webservices

  • You can call the API from Postman