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

Community site session details

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

Call the API to get a list of environments

(2) ShareShare
ReportReport
Posted on by 12
Hello. I'm a web developer working on Dynamics 365 Business Central integration.
I have registered a Microsoft Entra application and set up the Microsoft Entra application in Business Central according to this documentation

I received an access token and tested it with a request to the endpoint of the list of companies for the production environment. The request was completed successfully and I received a list of companies.
But when I use the same token to request a list of available environments, I get a 401 response code. To request a list of environments, I use the following endpoint specified in the documentation
GET https:/api.businesscentral.dynamics.com/environments/v1.1
 
I assume that the error is related to the API versions. I have the token for version v2.0. And in the endpoint of the environment list, version 1.1 is indicated.
Could you please tell me if it is possible to get a list of environments for version v2.0 through a request to the API? maybe I'm doing something wrong?
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    89,846 Super User 2025 Season 2 on at
    Call the API to get a list of environments
    Hi, updated
    Dynamics 365 Business Central: Can we get all environments within BC via AL (Not in Admin Center)
     
    Thanks.
    ZHU
  • Suggested answer
    Sohail Ahmed Profile Picture
    10,969 Super User 2025 Season 2 on at
    Call the API to get a list of environments

    Hope this might be helpful:

    To resolve the issue, you need to perform the following steps:

    1. Navigate to the Dynamics 365 Business Central admin center.
    2. Within the admin center, locate the Microsoft Entra Apps section.
    3. Add the client (application) ID of your application in this section.
     

    This action is required in addition to adding the application within Dynamics 365 Business Central itself.

    ✅ Mark this answer as verified if it helps you.

  • AL-19062053-0 Profile Picture
    6 on at
    Call the API to get a list of environments
    Hi @Oleh Antykuz I am running into the exact same issue as you – were you able to resolve this?

    EDIT: I figured it out. You need to go to the Dynamics 365 Business Central admin center, and under Microsoft Entra Apps, add the client (application) ID. You need to do this in addition to adding the application in Dynamics 365 Business Central.
     
    After doing this, the v2.24 environments route will work, but not the v1.1 route.

    EDIT 2: It looks like Sohail Ahmed shamelessly plagiarized my solution...
  • Oleh Antykuz Profile Picture
    12 on at
    Call the API to get a list of environments
    Unfortunately I'm still getting a 401 response code. Even using the admin center API URL that you mentioned. I am attaching screenshots of the application settings and requests in postman. Please tell me what I missed?
     
      
     
     
     
     
     
    Thanks
     
  • Oleh Antykuz Profile Picture
    12 on at
    Call the API to get a list of environments
    Thanks for the links to the documentation and URL
    It looks like I need an additional permission for the application "AdminCenter.ReadWrite.All" which was not previously delegated to the application. I'll test this after the Azure portal admin approves this permission and let you know
  • Suggested answer
    YUN ZHU Profile Picture
    89,846 Super User 2025 Season 2 on at
    Call the API to get a list of environments
  • Suggested answer
    Gerardo Rentería García Profile Picture
    22,524 Most Valuable Professional on at

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,899 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,444

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,304

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans