Azure Blob Storage in ASP.NET Core 2.0


How to use Azure Blob storage in ASP.NET Core.


Create a class library and add NuGet package: WindowsAzure.Storage

Add a class to encapsulate settings:

Add a class to encapsulate a blob item:

Add a class to encapsulate storage access. Add a private helper methods to access storage:

Now add public methods to upload and download blob items:

Add methods to get a list of blob items:

Inject and use storage helper:

Note: sample code has a controller with actions for listing, downloading and uploading items.

In ASP.NET Core Web Application, configure services:


The sample code will require you to setup Azure account, blob storage account and container. Instructions for these could be found at:

Source Code


Leave a Reply