Posts

Showing posts from June, 2023

How do I download a file from Azure Blob Storage to a .NET application?

This technique should work for any .NET Core application. Add the following Nuget packages: Azure.Identity Azure.Storage.Blobs Add a file to your project called BlobService.cs and paste the contents of this file . Next, instantiate and authenticate to your container. In this example, I am using the Connection String method. I have logged into the Azure Portal, and copied the connection string from the Access Keys page of the Storage Account. Click here for more information about Access Keys. Note: For production scenarios, you will want to register your application and use a client id/secret to authenticate. See here for details. string BlobConnectionString =     "DefaultEndpointsProtocol=https;AccountName=StevesStorageAccount;AccountKey=REDACTED==;EndpointSuffix=core.windows.net"; Emrick.CStringBlobService blobService =     new Emrick.CStringBlobService(BlobConnectionString, "file-uploads") Note that the constructor takes both the connection stri...