knowledgecenter-breadcrum

Knowledge Center

27 Feb, 2026

How to Use Parameters in Power BI to Connect to Microsoft Dataverse

Posted on 27 Feb, 2026 by Trupti Nikumbh, Posted in Power BI

Blogs

When working with multiple environments in Microsoft Dataverse (DEV, TEST, PROD), hardcoding the environment URL inside Power BI Desktop creates maintenance challenges.

If you move your report between environments, you would normally need to:

  • Edit the connection manually

  • Update credentials

  • Republish the file

But there’s a better way.

In this guide, you’ll learn how to use Parameters in Power BI to dynamically control your Dataverse connection.

Step 1 – Connect to Dataverse Normally (Initial Setup)

First, connect to Dataverse in the usual way.

Open Power BI Desktop.

Go to:

Home → Get Data → Dataverse

Enter your environment URL (example DEV):

 

https://devorg.crm.dynamics.com

Select your required table and click Load.

This creates the initial connection using a hardcoded URL.
 

Step 2 – Open Power Query Editor

Home → Transform Data

This opens the Power Query Editor where we will configure the parameter.


 

Step 3 – Create the Environment Parameter

Inside Power Query:

Home → Manage Parameters → New Parameter

Configure the parameter as follows:

 

Field Value
Name EnvironmentURL
Type Text
Suggested Values Any Value
Current Value https://devorg.crm.dynamics.

Click OK.

This parameter now stores your environment URL dynamically.


 

Step 4 – Replace Hardcoded URL in M Code

This is the most important part.

Select your Dataverse query.

Click:

Advanced Editor

You will see something like:

Source = CommonDataService.Database("https://devorg.crm.dynamics.com")

Replace it with:

Source = CommonDataService.Database(EnvironmentURL)

Important:

  • Remove quotation marks

  • Use the parameter name directly

Click Done.

Now your connection depends on the parameter value.



 

Step 5 – Apply Changes

Close & Apply

Your report now runs using the parameter instead of a fixed URL.

Step 6 – Publish to Power BI Workspace

Home → Publish

Choose your workspace in Power BI Service.

Step 7 – Configure Parameter in Power BI Service

Now go to:

app.powerbi.com → Workspace → Dataset → Settings

Scroll to the Parameters section.

You will see:

EnvironmentURL = https://devorg.crm.dynamics.com

Here you can change the value to:

https://prodorg.crm.dynamics.com

Click Apply.

This updates the dataset to use the new environment.


 

Step 9 – Refresh the Dataset

Click:

Refresh Now

Your dataset will now connect to the new Dataverse environment.

 

How It Works Behind the Scenes

Your M code contains:

CommonDataService.Database(EnvironmentURL)

During refresh:

Power BI replaces EnvironmentURL with the value stored in:

Dataset Settings → Parameters

That is how one PBIX file works across multiple environments.

 

Real Enterprise Deployment Scenario

Environment Parameter Value
DEV https://dev.crm.dynamics.com
TEST https://test.crm.dynamics.com
PROD https://prod.crm.dynamics.com

You publish once.

Then simply change the parameter value in Workspace.

Comment

This is a Required Field

Loading

Recent Updates

Embed PowerBI Report To Form
Blogs
09 Sep, 2026

Embed a Power BI Report on a Dynamics 365 Form, Filtered to the Record You're Viewing

Most Power BI reports in a Dynamics 365 environment live somewhere the user has to go and find: a dashboard,…

READ MORE
Blogs
08 Sep, 2026

How to Dynamically Retrieve SharePoint Drive IDs and List GUIDs for Power Automate

Introduction Many times, we come across scenarios where we need to populate a Word template in Dynamics 365 using Power…

READ MORE
Blogs
11 Aug, 2026

How to Remove an Unmanaged Layer from a Dataverse Email Template

Overview Email Templates in Microsoft Dataverse make it easy to reuse email content such as subject lines, message bodies, and…

READ MORE