Forum Discussion
Get Linked service token in Microsoft Fabric notebook
In synapse, I can add the Azure SQL Server service credentials into the settings and then access it from a notebook:
access_token = mssparkutils.credentials.getConnectionStringOrCreds('SQLProdLinkedService')
How can I do the same in Fabric?
5 Replies
- v-cboorla-msft
Microsoft Employee
Hi victorha
Thanks for using Microsoft Fabric Community.
Please refer to the following documentation on access token in Microsoft Fabric Notebook.
Link 1 : Reading and Writing Secrets in Azure Key Vault Using Microsoft Fabric Notebooks
Link 2 : Handling secrets in Fabric Notebooks - Azure Key Vault (youtube.com)
I hope this information helps. Please do let us know if you have any further questions.
Thank you.
- victorhaFrequent Visitor
Sorry I didn't specify before. In synapse, I connected an Azure SQL Database using a System Assigned Managed Identity and then I fetched the token directly through the credential utils.
Can I do something similar in Fabric?
If the same is not possible, what is the safest alternative?
- v-cboorla-msft
Microsoft Employee
Hi victorha
Apologies for the delay in response from my end.
Here are two methods on how to read and write secrets from within a notebook using the API as well as Fabric MSSPARKUTILS package. The Azure Key Vault API has been around for a while and is a very stable way of communicating with Azure Key Vault and is currently the best way to do so.
MSSPARKUTILS for Fabric makes the process significantly easier, BUT it currently does not have all the necessary functionality to accommodate writing secrets to Key Vault. Although the package lacks those capabilities, I believe it will soon have them as the Azure Synapse version of the package contains those abilities, so it will be just a matter of when and not if.
For additional information, please refer to the below documentation :
Link 1 : Reading and Writing Secrets in Azure Key Vault Using Microsoft Fabric Notebooks.
Link 2: Handling secrets in Fabric Notebooks - Azure Key Vault (youtube.com)
I hope this information helps. If you have any further details please do let us know.
Thank you.