Forum Discussion

NuwanAthukorala's avatar
NuwanAthukorala
Advocate II
10 months ago
Solved

Notebook parameters not passing through RunNotebook API call in Microsoft Fabric

Hi everyone,

I’m trying to trigger a Fabric notebook programmatically using the RunNotebook API, but it looks like the parameters I’m sending aren’t being passed into the notebook runtime.

The notebook runs fine when I start it manually in Fabric, but when I trigger it from my API, all the parameters show up empty inside the notebook.

 

I’m calling the following API endpoint:

POST https://api.fabric.microsoft.com/v1/workspaces/<workspaceId>/items/<notebookId>/jobs/instances?jobType=RunNotebook

 

Here’s a simplified version of my C# code:

 

var payload = new
{
name = $"Add_branch_notebook_{DateTime.UtcNow:yyyyMMdd_HHmmss}",
notebookInputParameters = new[]
{
new { name = "isf_code", value = isfCode },
new { name = "oracle_name", value = oracleName },
new { name = "oracle_code", value = oracleCode }
}
};

 

The request goes through successfully — I get a 200 response, and the notebook starts running.

 

But when I check the parameters inside the notebook using this code:

 

import os

 

isf_code = os.environ.get("isf_code", "")
oracle_name = os.environ.get("oracle_name", "")
oracle_code = os.environ.get("oracle_code", "")

 

print(isf_code, oracle_name, oracle_code)

 

all of them are empty.

If I run the same notebook manually in Fabric and define parameters in the UI (“Run with parameters”), it works perfectly — the values print correctly.
So the issue only happens when running it through the API.

 

I’ve tried

  • Verified the token scope (https://api.fabric.microsoft.com/.default)

  • Double-checked workspace and notebook IDs

  • Tested both of these endpoints:

    • /items/{notebookId}/jobs/instances?jobType=RunNotebook

    • /notebooks/{notebookId}/jobs
      Both run the notebook, but the parameters don’t show up.

  • Tried checking both os.environ and globals() — nothing there.

 

 

Is parameter passing currently supported when triggering a Fabric notebook using the RunNotebook API?

If it is, how are those parameters supposed to be accessed from inside the notebook?
(os.environ, sys.argv, or something else?)

If not yet supported, is this a known limitation or something still being rolled out?

 

Expected behavior

When I send this payload:

{
"name": "Add_branch_notebook_20251010_172200",
"notebookInputParameters": [
{ "name": "isf_code", "value": "ISF001" },
{ "name": "oracle_name", "value": "OracleDB1" },
{ "name": "oracle_code", "value": "ORC123" }
]
}

 

I expect the notebook to receive:

 

isf_code = ISF001
oracle_name = OracleDB1
oracle_code = ORC123

 

But instead, I’m getting all empty values.

 

Would really appreciate it if someone from the Fabric team or anyone who has successfully passed parameters to a notebook through the API can confirm how this is supposed to work (or if it’s not supported yet).

2 Replies