Forum Discussion

tan_thiamhuat's avatar
tan_thiamhuat
Icon for Post Patron rankPost Patron
1 year ago
Solved

Hide password in Notebook

With Fabric Notebook alone, (not in Data Pipelines, where we can use Parameters), how do we hide the password in database connection string? I remember in Databricks, we can actually hide that cell w...
  • v-hashadapu's avatar
    v-hashadapu
    1 year ago

    Hi tan_thiamhuat , Thank you for reaching out to the Microsoft Community Forum.

     

    As of May 2025, Fabric Notebooks don’t offer native cell-hiding or built-in secret management like Azure Key Vault. You can store your credentials in a JSON file within OneLake or a Lakehouse. You can then load the credentials in your notebook at runtime. To keep this secure, use Fabric’s role-based access control (RBAC) to restrict access to the folder containing the file. OneLake encrypts data at rest by default and RBAC ensures only authorized users can access the sensitive file. This keeps passwords out of your notebook code and lets you automate processes without exposing secrets. Just be sure not to log or print the credentials in notebook output and avoid committing this file to any version-controlled repositories.

     

    For development or one-off interactive tasks, a simpler option is to use Python’s getpass module to prompt the user to enter the password at runtime. This way, no password is stored in code or files, reducing the risk of accidental exposure. It’s ideal when you're running a notebook manually and don’t need automation.

     

    If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.