serilog-sinks-azureblobstorage icon indicating copy to clipboard operation
serilog-sinks-azureblobstorage copied to clipboard

Using Account SAS

Open strongdoctor opened this issue 3 years ago • 1 comments

Hi, I'm trying to use an Account SAS for a blob container, but it doesn't seem to work, any help would be appreciated. I've tried what feels like everything, but I can't get it working at all.

This is my my current setup:

var log = new LoggerConfiguration()
    .WriteTo.Async(a => a.AzureBlobStorage(
        formatter: new CompactJsonFormatter(),
        blobServiceClient: new BlobServiceClient(new Uri(config["SharedAccessSignature"])),
        storageContainerName: "somecontainer",
        storageFileName: "{yyyy}-{MM}-{dd}_log.txt"
    ))
    .CreateLogger();

where config["SharedAccessSignature"] is the full SAS token URI (https://).

The BlobServiceClient seems to get built correctly, or at least no exceptions are thrown with the current setup, and the account name is set as it should.

Thanks a lot.

strongdoctor avatar Mar 30 '22 13:03 strongdoctor

Overdue reply, but did you ever get this working? I did a lot of testing tonight for SaS and it worked with no issues.

I just used .WriteTo without Async, since Serilog 4 is now native async, and then I passed in a sharedAccessSignature and an accountUrl to complete the SaS connection. But your account should be fine as well.

chriswill avatar Jul 18 '24 05:07 chriswill

Closing old thread

chriswill avatar Aug 02 '24 18:08 chriswill