如何将 Azure blob-only 存储帐户与 Azure Functions 一起使用 - 尝试创建 blob 快照
How to use an Azure blob-only storage account with Azure Functions - Trying to create blob snapshot
我正在尝试设置一个函数,以便在每次将更改推送到 blob 容器时为其拍摄快照。 Azure Functions 中有一些非常简单的功能可以执行此操作,但它仅适用于通用存储帐户。我正在尝试使用仅 blob 存储帐户来执行此操作。我是 Azure 的新手,所以我可能完全错误地处理了这一切,但我找不到太多有用的信息。有什么办法吗?
中Visual Studio:
我已尝试为 仅 blob 存储 创建 快照
名为 joyblobstorage
,但失败了。我想你应该在屏幕截图中得到同样的错误。
如错误信息所述Microsoft.Azure.WebJobs.Host: Storage account 'joyblobstorage' is of unsupported type 'Blob-Only/ZRS'. Supported types are 'General Purpose'.
门户中:
我尝试创建一个 Function App 并 使用现有的 Storage,但找不到我的 blob -仅存储帐户。门户中的 Azure 函数设置不应允许我们 select 仅 blob 存储帐户。请参考截图。
结论:
不可能为仅 blob 存储创建快照。在官方文档中,您可以看到 Storage account requirements.
When creating a function app in App Service, you must create or link to a general-purpose Azure Storage account that supports Blob, Queue, and Table storage.
此外,在 App settings reference 中,您可以看到
AzureWebJobsStorage
The Azure Functions runtime uses this storage account connection string for all functions except for HTTP triggered functions. The storage account must be a general-purpose one that supports blobs, queues, and tables.
AzureWebJobsDashboard
Optional storage account connection string for storing logs and displaying them in the Monitor tab in the portal. The storage account must be a general-purpose one that supports blobs, queues, and tables.
这里是Feedback,Azure App Service Team已经解释了对存储帐户的要求,您可以参考它。
正如@joy-wang 提到的,Azure Functions Runtime requires a general purpose storage account.
需要通用存储帐户来配置 AzureWebJobsStorage 和 AzureWebJobsDashboard 设置(local.settings.json or Appsettings Blade in the Azure传送门):
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "my general purpose storage account connection string",
"AzureWebJobsDashboard": "my general purpose storage account connection string",
"MyOtherStorageAccountConnectionstring": "my blob only storage connection string"
}
}
如果您想创建一个 BlobTrigger Function,您可以指定另一个连接字符串并在每次 blob 为 created/updated:
时创建一个快照
[FunctionName("Function1")]
public static async Task Run([BlobTrigger("test-container/{name}",
Connection = "MyOtherStorageAccountConnectionstring")]CloudBlockBlob myBlob,
string name, TraceWriter log)
{
log.Info($"C# Blob trigger function Processed blob\n Name:{name}");
await myBlob.CreateSnapshotAsync();
}
我正在尝试设置一个函数,以便在每次将更改推送到 blob 容器时为其拍摄快照。 Azure Functions 中有一些非常简单的功能可以执行此操作,但它仅适用于通用存储帐户。我正在尝试使用仅 blob 存储帐户来执行此操作。我是 Azure 的新手,所以我可能完全错误地处理了这一切,但我找不到太多有用的信息。有什么办法吗?
中Visual Studio:
我已尝试为 仅 blob 存储 创建 快照
名为 joyblobstorage
,但失败了。我想你应该在屏幕截图中得到同样的错误。
如错误信息所述Microsoft.Azure.WebJobs.Host: Storage account 'joyblobstorage' is of unsupported type 'Blob-Only/ZRS'. Supported types are 'General Purpose'.
门户中:
我尝试创建一个 Function App 并 使用现有的 Storage,但找不到我的 blob -仅存储帐户。门户中的 Azure 函数设置不应允许我们 select 仅 blob 存储帐户。请参考截图。
结论:
不可能为仅 blob 存储创建快照。在官方文档中,您可以看到 Storage account requirements.
When creating a function app in App Service, you must create or link to a general-purpose Azure Storage account that supports Blob, Queue, and Table storage.
此外,在 App settings reference 中,您可以看到
AzureWebJobsStorage
The Azure Functions runtime uses this storage account connection string for all functions except for HTTP triggered functions. The storage account must be a general-purpose one that supports blobs, queues, and tables.
AzureWebJobsDashboard
Optional storage account connection string for storing logs and displaying them in the Monitor tab in the portal. The storage account must be a general-purpose one that supports blobs, queues, and tables.
这里是Feedback,Azure App Service Team已经解释了对存储帐户的要求,您可以参考它。
正如@joy-wang 提到的,Azure Functions Runtime requires a general purpose storage account.
需要通用存储帐户来配置 AzureWebJobsStorage 和 AzureWebJobsDashboard 设置(local.settings.json or Appsettings Blade in the Azure传送门):
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "my general purpose storage account connection string",
"AzureWebJobsDashboard": "my general purpose storage account connection string",
"MyOtherStorageAccountConnectionstring": "my blob only storage connection string"
}
}
如果您想创建一个 BlobTrigger Function,您可以指定另一个连接字符串并在每次 blob 为 created/updated:
时创建一个快照[FunctionName("Function1")]
public static async Task Run([BlobTrigger("test-container/{name}",
Connection = "MyOtherStorageAccountConnectionstring")]CloudBlockBlob myBlob,
string name, TraceWriter log)
{
log.Info($"C# Blob trigger function Processed blob\n Name:{name}");
await myBlob.CreateSnapshotAsync();
}