Accessing data inside Business Central
Now that we don’t have access to our Back end sql server of traditional NAV, how do we access Business Central data hosted on Microsoft cloud.
Few different ways
1. Out of the box APIs
2. OData Web services
3. Custom API extension pages
In this post, I am going to walk you through setting up the authentication for accessing these various endpoints
Setup Basic Authentication
In your Business Central tenant, Go to Users – Click on the Arrow to create a Web Service Access Key
You can now use this combination of User Name and Web Service Access Key to access the data inside Business Central.
To Test the APIs, Download/Open Postman.
Here is a sample GET request with Basic Authentication in Postman. My demo tenant Id is M365x817160.onmicrosoft.com. And I use a tenant specific end point to access the data. In your case, you will be replacing M365x817160.onmicrosoft.com with your AAD tenant ID.
https://api.businesscentral.dynamics.com/v1.0/M365x817160.onmicrosoft.com/api/beta
You can also get your AAD Tenant GUID from the Business Central URL, after you Login
Setup AAD access
In Portal.Azure.com, Navigate to Azure Active Directory - App Registration
Create a New Application registration
Once you Create the Web app, Navigate to the App Settings and the required permissions
+Add
Here, Select Dynamics 365
In the App’s Settings – Required Permissions, check the Delegated Permissions for Dynamics 365
In the Settings again, Create a Key. Make sure you copy the Key once you create it. As you will not be able to access it again.
Specify the Reply URLs in Settings
For AAD access, you will use the common endpoint
https://api.businesscentral.dynamics.com/v1.0/api/beta
In your Postman, Under Authorization, Select OAuth 2.0
Select Get Access New Token
In the Grant Type, Select Authorization Code.
1. In the Callback URL field, specify the URL specified as the sign-on URL/Reply URL in the Azure Portal.
2. In the Auth URL field, enter
https://login.windows.net/<your tenant domain>/oauth2/authorize?resource=https://api.businesscentral.dynamics.com
3. In the Access Token , enter the URL
https://login.windows.net/<your tenant domain>/oauth2/token?resource=https://api.businesscentral.dynamics.com
4. Specify the Application Id Generated in the App registration in Azure portal and the Key you copied in the Client Secret
Choose the Request token button.
The first time you log in, you will get prompted for consent. (If you have authenticated to a different tenant before, you can clear the cookies under the Send button)
Now you can use the Token to access the Business Central APIs with AAD authentication

Like
Report
*This post is locked for comments