Please wait
Talk to Expert
Microsoft Azure AD, Microsoft Dynamics Business central

Dynamics 365 Business Central: retrieving Azure AD User information via AL.


We need to handle OAuth2.0 authentication to obtain an access token and then call the Microsoft Graph API to get the required user information. This basic structure can be expanded to handle more complex scenarios and additional error handling as needed.

First, create a new Azure app.

Clicking on New registration.

After giving the name of the app.


Select a Single tenant.

Redirect URL Select public client native and added a URL.


After needing authentication.

Authentication→ add a platform→ web.


Added a redirect URL in configure Web and click on configure.


After needing an API Permissions.

API permissions→ Add a permission→ Microsoft Graph.


Select delegated permissions and added OpenID Permissions and user permission after clicking add permission.


Added an OpenID and User both permission Grant admin permission.


After needing to add a client secret.

Certificates & Secret → New client secret.


Client certificates Value is a client secret and needs to get auth token.


Application id is Client id and needs to get auth token.


After needing to endpoints token.

Overview→ Endpoints→ OAuth 2.0 token endpoint(v1).


After need, create one setup page and add all the required details.

Auth Client ID → Client ID [Azure App].

Client Secret → Client secret [Azure App].

Auth URL → Oauth 2.0 token endpoint(v1) [Azure App].

Auth Resource → Redirect URL [Azure App].

Auth Username → Login User ID [Azure Portal].

Password à Login User ID Password [ Azure Portal].


After need to create the below procedures in Al for getting auth token.


After creating a request procedure in AL as per the below Image.


Create one action in the customer list page and call a create request procedure pass request URI and getauthtoken in the parameter.





Thank you for investing your time to read our blog! We’re passionate about sharing valuable insights to help you navigate the world of Business Central.

If you’re curious about how we can assist you in reaching your goals, don’t hesitate to get in touch. Our dedicated team is ready to provide support every step of the way.

Let’s turn your vision into reality together!