Forum Discussion
How to Access Azure Key Vault Secrets in Fabric Notebook Using Managed Identity
- 8 months ago
Hi Ms_Techzill,
Iam not sure about the error message. But check out this nice video from Patrick. With this it worked for me.
Keep your secrets SAFE in Microsoft Fabric and Azure Key Vault
Also good to know that currently the actual notebook owner need to have the Key Vault RBAC rights as delegation to workspace identity or SP is not supported.
Best regards!
- 8 months ago
Hi Ms_Techzill , Thank you for reaching out to the Microsoft Community Forum.
Mauro89 was right about the core issue, the notebook runs under the user who executes it and that user must have Key Vault secret-read permissions. If they don’t, getSecret() throws the Py4JJavaError you’re seeing.
Your call is also failing because mssparkutils.credentials.getSecret() expects either a properly created linked service alias or the full Key Vault URL. Most of the time the alias doesn’t resolve, so call the vault directly using its endpoint and make sure the notebook runner has a Key Vault secrets role. Once you pass the URL and the user has permissions, the secret loads cleanly.
Introduction to Microsoft Spark utilities - Azure Synapse Analytics | Microsoft Learn
Grant permission to applications to access an Azure key vault using Azure RBAC | Microsoft Learn
NotebookUtils (former MSSparkUtils) for Fabric - Microsoft Fabric | Microsoft Learn
Microsoft Spark Utilities (MSSparkUtils) for Fabric - Microsoft Fabric | Microsoft Learn
- 8 months ago
Hello Mauro89 , thanks so much. I eventually changed it to the vault uri and it worked. Thank you
Hi Ms_Techzill,
I guess your Key Vault URI is not correct. Thats where you wrote "emailcommunicationkey", so the first parameter in the "get_secret" function.
Here acutally your "Vault URI" needs to be passed. This you can find if you open you Key Vault and go to the overview (marked in red):
Then the second parameter as being the acutal name of the secret.
This should work then as expected.
Best regards!
Hello Mauro89 , thanks so much. I eventually changed it to the vault uri and it worked. Thank you