Search code examples
c#visual-studio-2019azure-blob-storagevisual-studio-macazure-storage-emulator

The C# code running on Mac OS by Visual Studio 2019 for Mac is unable to write and read to/from the local Azure Storage Account Emulator


I used the following two connection strings in appsettings.json file to read and write from/to Azure Storage Emulator installed on my Mac machine:

"ConnectionString":"UseDevelopmentStorage=true"

And

"ConnectionString":"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;"

As a background, I installed Visual Studio 2019 for Mac on a fresh Mac machine. I guess Visual Studio 2019 for Mac must already have been shipped with the emulator. The Mac's operating system is macOS Catalina Version 10.15.6.

The problem that I am facing is that I am totally unable to have blobs written to, or read from the emulator and I keep getting connection refused error message. This issue keeps happening despite Microsoft Azure Storage Explorer installed on the Mac machine communicates with the emulator successfully, displays all blobs, writes and reads to/from the storage.

What is missing in my connection string configuration or what else I'm supposed to do on my Mac machine to have the C# code read and write from/to the storage emulator.


Solution

  • The Azure Storage Emulator only works on Windows and is being deprecated. Other platforms use Azurite, but the integration for it with Visual Studio is incomplete, so you have to run it manually:

    https://github.com/Azure/Azure-Functions/issues/1343#issuecomment-678536378

    This was all found with 5 minutes of consulting MSDN and using Google.