Skip to content

How to Use BCServicesAccess sample extension

Yury Opolev edited this page Oct 23, 2020 · 4 revisions

This is how-to for BCServicesAccess sample usage.

Prerequisites:

  • Business Central 17.1 or later
  • Registered Application in your tenant in Azure AD, see How-To here. To complete the steps that follow, you'll need information about the registered application, which you can get from the Azure portal.
  1. Install "Sample Services Access" extension.
  2. Open page 50105, “Sample Services Access”, click “Edit List” to switch to edit mode:

Step 2 image

  1. Fill out parameters needed to run sample actions:
    • “Aad Client Id” – use “Application (client) ID” value from registered app
    • “Aad Client Secret” – use “App Secret” value from registered app
    • “Redirect Url” – use “Redirect Uri” value from registered app
    • “Login Hint” – use UPN (Authentication email) of a user, which will acquire initial token. Normally this will be current user in Business Central.
    • “Authority Url” – use https://login.microsoftonline.com/<AAD TENANT ID>/oauth2

Step 3 image

  1. Click “Actions” – “Acquire Initial Token”. This will open a dialog window “Waiting for a response” and a popup window to enter user credentials:

Step 4.1 image

Step 4.2 image

Step 4.3 image

  1. When credentials are entered and verified, popup and dialog windows will close, and “Token” and “Cache” values will appear in “Initial Access Token + Token cache” section:

Step 5 image

  1. Fill out scopes to access with On-Behalf flow, which were previously configured and consented to in the registered app, for example:
    • For Graph: https://graph.microsoft.com/User.Read or just User.Read
    • For SharePoint: https://microsoft.sharepoint-df.com/Files.ReadWrite.All
    • For Business Central: https://dynamics.microsoft.com/business-central/overview/Financials.ReadWrite.All

Step 6 image

  1. Click “Actions” – “Acquire On-Behalf Access Token”. Status on currently selected line will change to “Token Acquired”. You can do that for every line to acquire on-behalf tokens for all services.

Step 7.1 image

Step 7.2 image

  1. Now you can click “Actions” - “See Access Token for Scope” to see and inspect on-behalf access tokens:

Step 8.1 image

Step 8.2 image

Clone this wiki locally