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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
amaaiia
Super User
Super User

How to pass parameters to notebook to be used in %%configure cell

I want to configure the default lakehouse of my notebook programatically, I want the default lakehouse to be passed through parameters.

 

I've found a way to configure the default lakehouse with %%configure script:

amaaiia_0-1712651777267.png

It works if I directly write the lakehouse name, id and workspace id in the same cell, and I run this cell the first one before the rest of the cells. But I want these three values to be passed by parameter, so I need to run parameters cell before %%configure cell, and if I do that, I get and error:

MagicUsageError: The current running Livy session must be restarted for the config changes to take effect. Specify the argument "-f" to force restarting Livy session. Any variables stored in memory will be cleared.

So, how can I pass the parameters to %%configure cell if I have to run %%configure cell before any other to work?

 

1 ACCEPTED SOLUTION
Expiscornovus
Super User
Super User

Hi @amaaiia,

 

You can use Parameterized session configuration for this:

https://learn.microsoft.com/en-us/fabric/data-engineering/author-execute-notebook#parameterized-sess...

 

Below is an example code snippet

 

%%configure  

{ 
    "defaultLakehouse": { 
        "name": {
                  "parameterName": "defaultLakehouseName",
                  "defaultValue": "FourthLakehouse"
        },
        "id": {
                  "parameterName": "defaultLakehouseId",
                  "defaultValue": "773faa37-826f-4f9b-830f-e2a7a23e3903"
        }
    }
}

 

 



Happy to help out 🙂

I share #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel

View solution in original post

3 REPLIES 3
Expiscornovus
Super User
Super User

Hi @amaaiia,

 

You can use Parameterized session configuration for this:

https://learn.microsoft.com/en-us/fabric/data-engineering/author-execute-notebook#parameterized-sess...

 

Below is an example code snippet

 

%%configure  

{ 
    "defaultLakehouse": { 
        "name": {
                  "parameterName": "defaultLakehouseName",
                  "defaultValue": "FourthLakehouse"
        },
        "id": {
                  "parameterName": "defaultLakehouseId",
                  "defaultValue": "773faa37-826f-4f9b-830f-e2a7a23e3903"
        }
    }
}

 

 



Happy to help out 🙂

I share #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel

Is there a way to supply additional parameteres for use later on in the notebook?

It works!!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

September Fabric Update Carousel

Fabric Monthly Update - September 2025

Check out the September 2025 Fabric 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.