web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Business Central API - Azure AD Authorization flow

(0) ShareShare
ReportReport
Posted on by 5

Hello,

I've done some extensive research on how to use the Authentication flows from Azure AD but the documentation is not clear on what we are trying to achieve.

The following question is similar but has never been really answered:

https://community.dynamics.com/business/f/dynamics-365-business-central-forum/292569/business-central-api---authentication-with-client-id-and-secret

The problem:

We need to create an external application that we'll interact with the Business Central API WITHOUT user interaction. This external application might run on a scheduled base so the user won't be able to provide credentials

Microsoft Documentation states that we can use 2 types of auth:

1. Azure AD 

2. Basic Auth (username web service access key) 

Solution number 2 above would work for us, but the documentation says it DOES NOT work in production and therefore it is only useful to explore the API.

We are then forced to use solution 1 (Azure AD), but none of the authentication flows seems to work because they need the user to sign in.

The one I thought it would work is the Client Credentials: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#client-credentials

We tried the following:

IConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
.WithClientSecret(config.ClientSecret)
.WithAuthority(new Uri(config.Authority))
.Build();

string[] scopes = new string[] { $"{config.ApiUrl}.default" }; //https://api.businesscentral.dynamics.com/.default


AuthenticationResult result  = await app.AcquireTokenForClient(scopes)
                    .ExecuteAsync();

The Access Token that the code above return gives a "Unauthorized" code when you make a request to:

api.businesscentral.dynamics.com/.../companies

Can anyone help and provide some guidance?

Thank you,

  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

    Thanks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 545 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 354 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 228 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans