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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
g3kuser
Helper I
Helper I

mssparkutils credentials library in notebook

Hi
 
With recent support of SPN authentication with Fabric ci-cd libraries, I am trying to deploy pipelines and notebook through SPN. I see the item owner as the SPN.  I have the following code in notebook which doesn't mention any credential. Is this using SPN credentials/User credential/Workspace Identity. 
 
secret_value = notebookutils.mssparkutils.credentials.getSecret(keyvault_url,'secret_name)
mssparkutils.credentials.getToken("https://api.fabric.microsoft.com/")
 
I have not given workspace identity access to key vault so I doubt if secret reading call goes that that auth.
 
I did notice in Monitoring when notebook executed through a pipeline has submitted user for notebook execution as SPN who is the item owner as well.
 
Can anyone help me in understanding the process?
 
Thanks,
 
Gayatri
 
1 ACCEPTED SOLUTION
nilendraFabric
Super User
Super User

Hi @g3kuser 

 

When you call the mssparkutils credentials functions without specifying any explicit credentials or linked service parameters, the runtime automatically uses the identity under which the notebook is executing. In your case, because the notebook is being deployed and run through a Fabric pipeline configured with SPN authentication—and the SPN appears as the item owner—the mssparkutils calls are using the service principal’s credentials.

 

 

In your current setup, since no explicit workspace identity configuration is provided (or its permissions granted for Key Vault access), the secret retrieval and token acquisition calls fall back to using the SPN credentials

View solution in original post

3 REPLIES 3
g3kuser
Helper I
Helper I

Hi @nilendraFabric 

I am curious to understand how it worked without the need for client secret to be passed to the process.

nilendraFabric
Super User
Super User

Hi @g3kuser 

 

When you call the mssparkutils credentials functions without specifying any explicit credentials or linked service parameters, the runtime automatically uses the identity under which the notebook is executing. In your case, because the notebook is being deployed and run through a Fabric pipeline configured with SPN authentication—and the SPN appears as the item owner—the mssparkutils calls are using the service principal’s credentials.

 

 

In your current setup, since no explicit workspace identity configuration is provided (or its permissions granted for Key Vault access), the secret retrieval and token acquisition calls fall back to using the SPN credentials

Thank you for the explanation. As the executing user is SPN I am unable to understand how token was retrieved without the need of client secret to be supplied for the process. 

Helpful resources

Announcements
Fabric July 2025 Monthly Update Carousel

Fabric Monthly Update - July 2025

Check out the July 2025 Fabric update to learn about new features.

July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.