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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
tan_thiamhuat
Contributor II

Fabric -- secrets

Are we able to do the below? How or where to store the secrets, so that it can be retrieved? It seems cannot on my side.

Option 1: Using Notebook Secrets

  1. In Fabric, go to the Notebooks area.

  2. Click on the Settings / Environment (gear icon) for your notebook.

  3. Look for Secrets or Environment Variables.

  4. Add a new secret:

    • Name: OPENAI_API_KEY

    • Value: your OpenAI key (e.g., sk-xxxxx...)

  5. In your notebook, use Python code to access it:

     
    import os OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") from openai import OpenAI client = OpenAI(api_key=OPENAI_API_KEY)
1 ACCEPTED SOLUTION
v-echaithra
Honored Contributor II

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.

View solution in original post

6 REPLIES 6
ChielFaber
Contributor III

I don't have any direct experience regarding your question, but I do believe the following earlier post answers your question.

 

https://community.fabric.microsoft.com/t5/Fabric-platform/Handling-secrets-in-Fabric-Notebooks/m-p/3...

 

In this link are several links to youtube videos and guides to solve your question.

 

Hope this is helpfull.

 

Regards,

 

Chiel

 


[Tip] Keep CALM and DAX on.
[Solved?] Hit โ€œAccept as Solutionโ€ and leave a Kudos.
[About] Chiel | SuperUser (2023โ€“2) |
tan_thiamhuat
Contributor II

I know of Azure Key Vault, say for example, I do not have Azure subscription, how /what should I do next?

v-echaithra
Honored Contributor II

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.

v-echaithra
Honored Contributor II

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.

v-echaithra
Honored Contributor II

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.

v-echaithra
Honored Contributor II

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.

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Free Fabric Certifications

Free Fabric Certifications

Get Fabric certified for free! Don't miss your chance.

January Fabric Update Carousel

Fabric Monthly Update - January 2026

Check out the January 2026 Fabric update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (196)