'Azure Functions: There was an error performing a read operation on the Blob Storage Secret Repository

In testing Azure Functions locally, I am receiving this error.

"There was an error performing a read operation on the Blob Storage Secret Repository. Please ensure the 'AzureWebJobsStorage' connection string is valid."

I have Azure Blob Storage setup, including Storage Emulator and Storage Explorer. How can this be fixed?



Solution 1:[1]

My Two cents.

I am trying to run a durable function on my local computer.

I was getting this error.

There was an error performing a read operation on the Blob Storage Secret Repository. Please ensure the 'AzureWebJobsStorage' connection string is valid

I looked at this answer from the github issue.

I completely deleted my folder the path for which is as follows

C:\Users\YourUserName\AppData\Local\Temp\Azurite 

Now things are running fine again.

The folder looks like this.

Azurite folder on Windows

Solution 2:[2]

The answer by @mattsmith5 is not correct. Please do not change the "AzureWebJobsStorage" parameter to your live storage account, as additional costs can occur and you maybe have unforeseen side effects or impact on you online environment. The storage emulator is long deprecated, you should use azurite to emulate storage locally. You can download azurite for example with npm (npm install -g azurite) or in many other ways.

"UseDevelopmentStorage=true" is exactly the correct setting to use in a local environment, especially when you are going to use durable functions or other compute or I/O heavy tasks. Regarding you problem, azurite creates multiple json files in the folder where you execute it for its virtual storage backend. If you run azurite without any parameters, the following files should be existent:

  • __azurite_db_blob_extent__.json
  • __azurite_db_queue__.json
  • __azurite_db_queue_extent__.json
  • __azurite_db_table__.json

In addition there are normally two or more folders called similar to this:

  • __blobstorage__
  • __queuestorage__

To force the azure-functions-core-tools runtime to reset storage claims and handles, first stop azurite and all func instances, delete the above files and folders and start it again (azurite first).

All the content will of course be gone, but local development storage should never be used for persistent data.

Solution 3:[3]

None of the other answers worked for me so I'll share my solution here. I tried:

  • Changing AzureWebJobsSecretStorageType
  • Killing the azurite process and restarting it
  • Removing all the files from AppData

None of that worked. The fix for me was to install azurite using npm install -g azurite and then run it with azurite. After that my old project started working again.

Solution 4:[4]

For anybody else who continues to get blob read errors after setting "AzureWebJobsSecretStorageType": "Files", downgrading the Microsoft.Azure.WebJobs.Extensions.Storage package from v5 to v4 can fix it. (I used v4.0.5).

This may be specific to .NET projects. If you are new to modifying c# dependencies, in your .csproj file find the PackageReference object and change the version. You can then run dotnet restore to update/refresh.

For those that don't like reading text:

project-name.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
      ...
  </PropertyGroup>
  <ItemGroup>
    ...
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.5"/>
    ...
  </ItemGroup>
  ...
</Project>

For the sake of SEO, this was my error:

System.InvalidOperationException: Secret initialization from Blob storage failed due to missing both an Azure Storage connection string and a SAS connection uri. For Blob Storage, please provide at least one of these. If you intend to use files for secrets, add an App Setting key 'AzureWebJobsSecretStorageType' with value 'Files'.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 itpropro
Solution 3 Andrei Dvoynos
Solution 4 exax