Forum Discussion

Soobramoney's avatar
Soobramoney
Icon for Advocate I rankAdvocate I
1 year ago
Solved

Fabric - Setting a tenant on notebooks

Hi,    I'm trying to retrieve a key vault secrete that's on a different tentant, but I get the following error      Py4JJavaError: An error occurred while calling o4768.getSecretWithToken. ...
  • nilendraFabric's avatar
    1 year ago

    If you need to access a Key Vault in a different tenant, you’ll need to ensure that:
    1. The managed identity of your Fabric workspace has been granted access to the Key Vault in the target tenant.
    2. The Key Vault’s access policies or RBAC settings allow access from your managed identity.
    Use Fabric’s Secret Management
    Azure Fabric provides built-in secret management capabilities. Instead of accessing the Key Vault directly from your notebook, consider storing the secret in Fabric’s secret management and accessing it from there:


    from notebookutils import mssparkutils

    secret_value = mssparkutils.secrets.get("your-secret-name", "your-secret-scope")
    print(secret_value)