Use DefaultAzureCredential for managed identity in azure blob extention #7149

Closed
opened 2026-02-21 18:19:09 -05:00 by yindo · 2 comments
Owner

Originally created by @te-chan2 on GitHub (Dec 11, 2024).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • 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?

  • I am interested in contributing to this feature.
Originally created by @te-chan2 on GitHub (Dec 11, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [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.
yindo added the 💪 enhancementstale labels 2026-02-21 18:19:09 -05:00
yindo closed this issue 2026-02-21 18:19:09 -05:00
Author
Owner

@hzywind commented on GitHub (Jan 4, 2025):

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 commented on GitHub (Jan 4, 2025): 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. :)
Author
Owner

@dosubot[bot] commented on GitHub (Feb 4, 2025):

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] commented on GitHub (Feb 4, 2025): Hi, @te-chan2. I'm [Dosu](https://dosu.dev), 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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7149