Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Johan
Advocate II
Advocate II

api to business central sandbox environment fails using Dynamics365BusinessCentral.Contents

When connecting to a Business Central company in the sandbox environment I get this error:

The environment "Production" does not exist. Tenant: xxxx. The exception was raised by the IDbCommand interface.

 

It's trying to connect to the Production environment by default

 

How  to set the right Environment?

 

Thanks,

Johan

1 ACCEPTED SOLUTION
BhavinVyas3003
Super User
Super User

Hi @Johan ,

 

In Power BI (Power Query M), modify your connection like this:

let

    Source = Dynamics365BusinessCentral.Contents(

        "yourtenant.onmicrosoft.com",

        "Sandbox"              // ← specify your sandbox environment here

    )

in

    Source

Replace "yourtenant.onmicrosoft.com" and "Sandbox" with exact values from your Azure AD and Business Central admin portal.


Thanks,
Bhavin
Problem solved? Hit “Accept as Solution” and high-five me with a Kudos! Others will thank you later!

View solution in original post

4 REPLIES 4
v-echaithra
Community Support
Community Support

Hi @Johan ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @Johan ,

We wanted to kindly follow up to check if the solution provided by @BhavinVyas3003   for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Chaithra.

v-echaithra
Community Support
Community Support

Hi @Johan ,

May I ask if you have gotten this issue resolved?

 

If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

 

Regards,
Chaithra.

BhavinVyas3003
Super User
Super User

Hi @Johan ,

 

In Power BI (Power Query M), modify your connection like this:

let

    Source = Dynamics365BusinessCentral.Contents(

        "yourtenant.onmicrosoft.com",

        "Sandbox"              // ← specify your sandbox environment here

    )

in

    Source

Replace "yourtenant.onmicrosoft.com" and "Sandbox" with exact values from your Azure AD and Business Central admin portal.


Thanks,
Bhavin
Problem solved? Hit “Accept as Solution” and high-five me with a Kudos! Others will thank you later!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors