Blob 存储与 Azure Functions 的兼容性

Blob storage compatibility with Azure Functions

我有一些电子邮件附件正在保存到 Azure Blob。

我现在正在尝试编写一个 Azure Functions 应用程序来连接到该 blob 存储,运行 一些脚本并重新保存文件。

但是,当select为函数创建存储帐户时,我无法select我的 blob 存储帐户。

我去网站上是这样说的:

When creating a function app, you must create or link to a general-purpose Azure Storage account that supports Blob, Queue, and Table storage. Some storage accounts don't support queues and tables. These accounts include blob-only storage accounts and Azure Premium Storage.

我想知道,有什么解决方法吗?如果没有,也许还有其他建议吗?我对所有选项以及实际选择哪个选项感到有点迷茫。

谢谢!

编辑:我可以添加我编写函数 Python

您引用的网站片段用于存储功能应用程序代码本身和任何相关模块。它与您的函数代码执行时您的函数可以访问的内容无关。

当您的函数执行时,它将需要使用 Azure Blob 存储 SDK/modules 连接到您的 blob 存储帐户并读取电子邮件附件。这是将 Azure 存储与 Python 结合使用的快速入门指南:Quickstart with Azure Storage Blobs SDK for Python

我认为您忽略了可以拥有多个存储帐户这一事实。为了让 Azure Functions 起作用,你需要一个存储帐户。该存储帐户用于存储 Azure Functions 的运行时信息,用于内部目的,如状态管理。正如您已经发现的那样,此存储帐户受到限制。没有解决方法。

但是,如果您正在编写的函数需要访问另一个存储帐户,那么这样做是免费的。您只需提供连接到该特定存储帐户的详细信息。在这种情况下,您还可以明确区分 azure 函数用于其内部操作的存储帐户和您的应用程序需要连接的存储帐户,并且您可以完全控制这些帐户,而不必担心删除会破坏内容内部使用 blobs/tables/queues.

您可以拥有一个 blob 触发函数,当您的特定 blob 存储发生变化时该函数会被触发。不一定是azure函数内部使用的存储账户,创建azure函数时是created/selected

Here 是一个示例,展示了如何在 Python 中添加 blob 触发的 azure 函数。 MyStorageAccountAppSetting 指的是一个应用程序设置,该设置包含用于存储的存储帐户的连接字符串。

通用 v2 存储帐户支持最新的 Azure 存储功能,并包含通用 v1 和 Blob 存储帐户的所有功能here

有更多与 GPv2 帐户的集成选项,包括 Azure 函数触发器。参见:Azure Blob storage bindings for Azure Functions

进一步参考:Types of storage accounts 如果是 Blob,根据您的需要,您可以根据数据(电子邮件附件)的访问频率选择访问层Access tiers for Azure Blob Storage - hot, cool, and archive。如果是通用存储帐户,则为标准性能层。