Forum Discussion

LW07's avatar
LW07
Frequent Visitor
6 months ago
Solved

API secrets without Azure Key Vault

Hi I'm currently learning to work with Fabric. One of my learning tasks is translating our old processes into Fabric native processes. I need to hold an API key and secret but my own Azure permission...
  • spaceman127's avatar
    spaceman127
    6 months ago

    Hi LW07 ,

     

    you have two options for reading a secret from a Key Vault.

     

    Option 1:

    As already described by deborshi_nag , you use the Fabric Connection with Notebook. However, this is still in preview. You also need permissions on the Key Vault to read it. 

     

    Option 2:

    You use code to read the data from a Key Vault. The administrator of your organization must also assign you the role “Key Vault Secrets User.” Then you can read the secrets.

     

    Here an Example to read from with python. In my example, I define a few parameters in the notebook beforehand. You don't necessarily need them.

     

    import requests
    
    app_client_id = mssparkutils.credentials.getSecret(f"https://{key_vault_name}.vault.azure.net/", kvclientid_1)

     

    For security reasons, I advise against writing secrets in plain text anywhere. If possible, you should always use a key vault.

     

    I hope this helps.

     

    Best regards.

    Rene

     

    Feel free to leave kudos or accept it as a solution. This will also help other community members.

     

  • LW07's avatar
    5 months ago

    There aren't really any good solutions that don't involve invoking assistance from other members of staff who have Azure responsibilities. So I don't think my question is resolved in the format I would prefer it, but I appreciate the responses from everyone. Many thanks.