Azure blob storage service allows user to create / update / upload unstructured data in Azure. Later, user can access / download this data from anywhere in the world. This data can be Audio, Video, Image, Text or Log file. We can also use these service for streaming video or audio files. Users are directly allow to create / upload blob from Azure portal or developer can also create / upload blob via code. We can access these blobs via HTTP / HTTPS service also.
Container: You can consider container as Folder / Directory in file system. So it means each container can have multiple blobs of same or different type.
Storage account: Storage account contains all storage data objects like blob, queue, table etc.
There are mainly three types of blobs available on Azure:
- Block blob: Block blobs includes features that help you manage large files over network. E.g. Image file, video file etc.
- Page blob: Page blobs store the virtual hard drive (VHD) files serve as disks for Azure virtual machines.
- Append blob: Mostly, we are using this type of blob for appending content to existing file. E.g. Log file
Lets upload new image to Azure using C# Web API. We are going to upload block blob here.
- Create Azure free account if you don’t have subscription.
- Need to create “Storage account” in Azure portal.
- Create Web API project. I have choose .Net core 2.1 for this example.
- Install “Microsoft.Azure.Storage.Blob” nuget package to this project.
- Please provide Azure storage account connection string in appsettings.json file. If we want to test it locally then we can provide below connection string rather than to provide actual one.
I’ve upload this solution to Github here. Feel free to clone the git repository.