Forum Discussion
Circular Error When Trying to Use Key Vault
- 2 years ago
Thanks for following up. Yes, it appears that using a Managed Identity would be the best approach. However, I'm only using an F2 license. So I decided to instead use a workspace resource as a variable in the notebook. I know that this isn't the most secure approach but it works for what I am trying to accomplish.
Hi kewaynes333
Thanks for using Microsoft Fabric Community.
Yes, a circular dependency issue where DefaultAzureCredential needs the client secret, but retrieving the secret requires authentication that might also rely on DefaultAzureCredential, this can be a challenge.
Below is the approache to achieve secure access to Azure Key Vault without exposing the secret in your code:
Enable Managed Identity for your application running in Microsoft Fabric even for the initial setup. With managed identity, Azure internally manages the application's service principal and automatically authenticates the application with other Azure services. Managed identity is available for applications deployed to a variety of services. This allows DefaultAzureCredential to acquire a token using the application's identity without needing a client secret. Once you have access with Managed Identity, you can retrieve the client secret from Key Vault for future use.
Please refer the documentation for more details : Authenticate to Azure Key Vault | Microsoft Learn
For additional information please refer : Reading and Writing Secrets in Azure Key Vault Using Microsoft Fabric Notebooks
I hope this information helps. Please do let us know if you have any further queries.
Thank you.