Context: I'm building a web app, that reads data from json files, my plan is to host these json flatfiles in Azure blob storage, then to expose them to my Web app through an API. Right now, I am trying to build a local dev environment.
My short-term goal is to setup azurite in a docker container and build a simple console app that connect to the local azurite emulator and reads one json file.
to get started, I have the azurite running in a docker container using a docker compose file.
version: '3.9'
services:
azurite:
image: mcr.microsoft.com/azure-storage/azurite
container_name: 'azurite-console'
hostname: azurite
restart: always
command: 'azurite --oauth basic --cert /workspace/127.0.0.1.pem --key /workspace/127.0.0.1-key.pem'
ports:
- 10000:10000
- 10001:10001
- 10002:10002
volumes:
- ./certs:/workspace
This seems to be working just fine, notice the https:
I created the certificates using mkcert
however, if I run the following
static void Main(string[] args)
{
// With container URL and DefaultAzureCredential
var client = new BlobServiceClient(
new Uri("https://127.0.0.1:10000"),
new DefaultAzureCredential()
);
Console.WriteLine("\nlist containers");
try
{
var containers = client.GetBlobContainers();
foreach (var c in containers)
Console.WriteLine(c.Name);
}
catch(Exception ex){
Console.WriteLine(ex.Message);
}
}
I get the following exception:
Retry failed after 6 tries. Retry settings can be adjusted in ClientOptions.Retry. (The SSL connection could not be established, see inner exception.)
my gut tells me that the dotnet app somehow needs to use the certificate to access azurite running on docker, but I'm too much of a noob when it comes to this, does anyone have any ideas of where i am going wrong?