Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
In Fabric, go to the Notebooks area.
Click on the Settings / Environment (gear icon) for your notebook.
Look for Secrets or Environment Variables.
Add a new secret:
Name: OPENAI_API_KEY
Value: your OpenAI key (e.g., sk-xxxxx...)
In your notebook, use Python code to access it:
Solved! Go to Solution.
Hi @tan_thiamhuat ,
Thank you for reaching out to Microsoft Community.
The most secure and supported method to manage secrets in Fabric Notebooks is by using Azure Key Vault and accessing secrets through the built‑in utilities.
Use the notebookutils.credentials.getSecret() method (formerly mssparkutils.credentials.getSecret) to securely fetch secrets.
You can refer to this blog : How-To Access Azure Key Vault Secrets from Fabric Notebook - Syntera
Hope this helps.
Chaithra E.
Hi @tan_thiamhuat ,
May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.
Thank you.
Hi @tan_thiamhuat ,
We’d like to follow up regarding the recent concern. Kindly confirm whether the issue has been resolved, or if further assistance is still required. We are available to support you and are committed to helping you reach a resolution.
Best Regards,
Chaithra E.
Hi @tan_thiamhuat ,
I hope the information provided is helpful.I wanted to check whether you were able to resolve the issue with the provided solutions.Please let us know if you need any further assistance.
Thank you.
Hi @tan_thiamhuat ,
Thank you for reaching out to Microsoft Community.
The most secure and supported method to manage secrets in Fabric Notebooks is by using Azure Key Vault and accessing secrets through the built‑in utilities.
Use the notebookutils.credentials.getSecret() method (formerly mssparkutils.credentials.getSecret) to securely fetch secrets.
You can refer to this blog : How-To Access Azure Key Vault Secrets from Fabric Notebook - Syntera
Hope this helps.
Chaithra E.
I know of Azure Key Vault, say for example, I do not have Azure subscription, how /what should I do next?
I don't have any direct experience regarding your question, but I do believe the following earlier post answers your question.
In this link are several links to youtube videos and guides to solve your question.
Hope this is helpfull.
Regards,
Chiel