4
votes

I'm trying to set up a function to take a snapshot of a blob container every time a change is pushed to it. There is some pretty simple functionality in Azure Functions to do this, but it only works for general purpose storage accounts. I'm trying to do this with a blob only storage account. I'm very new to Azure so I may be approaching this all wrong, but I haven't been able to find much helpful information. Is there any way to do this?

2
Please edit your question and include more details. For example, include the code to take snapshot. What happens when you try to take a snapshot for blobs in blob storage account? Are you getting any error? In its current state, there's not much information available in the question to provide meaningful solution.Gaurav Mantri
You mean you have a blobtrigger function ? If so you need to understand that Azure functions needs a storage account because it uses storage table to persist data. This is configured using AzureWebJobsStorage and AzureWebJobsDashboard but you can configure your blobtrigger function to use a different connectionstring. Does it make sense for you ? Would you like some code sample ?Thomas
Yes it is a blob trigger. How would I go about making the function use a different connection string? According to Microsoft documentation the storage account would have to be general purpose to connect to the function trigger. In the UI my storage container is never an option.L. Hanson

2 Answers

3
votes

As @joy-wang mentioned, the Azure Functions Runtime requires a general purpose storage account.

A general purpose storage account is required to configure the AzureWebJobsStorage and the AzureWebJobsDashboard settings (local.settings.json or Appsettings Blade in the Azure portal):

{
  "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"
  }
}

If you want to create a BlobTrigger Function, you can specify another connection string and create a snapshot everytime a blob is 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();
}
0
votes

In the Visual Studio:

I have tried to create snapshot for a blob-only storage named joyblobstorage , but it failed. I supposed you should get the same error in the screenshot.

enter image description here

As the error information says Microsoft.Azure.WebJobs.Host: Storage account 'joyblobstorage' is of unsupported type 'Blob-Only/ZRS'. Supported types are 'General Purpose'.

In the portal:

I try to create a Function App and use the existing Storage, but it could not find my blob-only storage account. Azure Function setup in portal should not allow we to select a blob-only storage account. Please refer to the screenshot.

enter image description here

Conclusion:

It is not possible to create snapshot for a blob-only storage. In the official documentation, you could see the 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.

Also, in the App settings reference, you could see

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.

Here is the Feedback, Azure App Service Team has explained the requirements on storage account, you could refer to it.