dify icon indicating copy to clipboard operation
dify copied to clipboard

Use DefaultAzureCredential for managed identity in azure blob extention

Open te-chan2 opened this issue 1 year ago • 1 comments

Self Checks

  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • [X] Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

I prefer not to save the key as an environment variable when using Dify on Azure. I would like to modify it so that when AZURE_BLOB_ACCOUNT_KEY is set to managedidentity, it uses DefaultAzureCredential to leverage the Managed Identity assigned to the resource.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • [X] I am interested in contributing to this feature.

te-chan2 avatar Dec 11 '24 11:12 te-chan2

This is a great feature. I have similar need, which is to use Service Principal or Managed Identity for authentication, depending on the actual situation of the deployment environment. Using DefaultAzureCredential is very correct and recommended by Azure, which can select different authentication methods in order according to different environments (environment variables). Therefore, using DefaultAzureCredential is not just for Managed Identity. I suggest adding an AZURE_BLOB_AUTH_MODE configuration item with sas and azure_default as options and set the default value to sas for backward compatibility. When azure_default is selected, DefaultAzureCredential is used. I am happy to help if needed. :)

hzywind avatar Jan 04 '25 10:01 hzywind

Hi, @te-chan2. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary

  • The issue proposes enhancing the Azure Blob extension to use DefaultAzureCredential for authentication.
  • The goal is to improve security by leveraging Managed Identity when AZURE_BLOB_ACCOUNT_KEY is set to managedidentity.
  • @hzywind supports the feature and suggests a broader implementation with Service Principal or Managed Identity.
  • A new configuration AZURE_BLOB_AUTH_MODE is proposed, with options sas and azure_default.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting on the issue.
  • If there is no further activity, the issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Feb 04 '25 16:02 dosubot[bot]