DEV Community

ROHAN KADAM
ROHAN KADAM

Posted on • Originally published at Medium

How to upload a file to Azure Blob using Spring Boot?

Hello👋, Its Rohan Kadam😊

Today cloud is becoming come standard for the development of any software. We used the cloud in every aspect of the programming cycle be it uploading our code to Github or Gitlab or be it using Google Drive or Dropbox or uploading our personal files. In the article, we are going to understand how we can implement file** upload to Azure Blob Using Spring Boot**.

How to upload a file to Azure Blob Using Spring Boot?

What Does Blob Storage Mean?

Blob storage is a feature in Microsoft Azure that lets developers store unstructured data in Microsoft’s cloud platform. This data can be accessed from anywhere in the world and can include audio, video and text. Blobs are grouped into “containers” that are tied to user accounts. Blobs can be manipulated by using any programming language. Blobs are widely used by streaming companies with high volumes of audio and video data.

Why used Blob Storage?

Blob storage is ideal for:

  • Accessing images or documents directly to devices.

  • Storing files for distributed access.

  • Streaming video and audio.

  • Storing data for backup and restore disaster recovery, and archiving.

  • Storing data for analysis by an on-premises or Azure-hosted service

How to implement blob Storage?

Blob Storage is widely been used by the industry today for developing great user-friendly apps. Its best known for storing files, images and binary data. Today we are going to implement the Azure Blob using the spring boot and the programming language Java. In this part of we going to cover the Read, Write and Upload operations for the same.

Step 1: How to generate Spring Boot Project?

Spring Initializr

Step 2: Which dependencies should I include?

Dependencies

Step 3: What will the configuration be for my Azure?

When we talk of configuration is we required three main parts

  1. Blob Container Name

  2. Account Key — Secret Key

  3. Blob Container Endpoint

Credits: Microsoft

Note:- Need to get the above from the Azure website.

Step 4:- Need to Create a Controller endpoint for Upload & Read file.

1 →How to upload files to Azure Blob Storage?

Upload File to Blob Storage

2 →How to read files from Azure Blob Storage?

Read File From Blob Storage

3 →How to write files to Azure Blob Storage?

Write Blob From Storage

Step 5: Postman Endpoint Upload File.

azure_blob_upload_file

Step 6: Postman Endpoint for reading File.

azure_blob_read_file

Conclusion:-

In the article, we tried to answers many questions related to Azure Blob and how to implement the same using Spring boot. Blob storage has widely been used to store unstructured data such as text, images or binary etc are used by many fortune 500 companies to provide service to their users.

Please do share and like💖 if you find the article useful. Follow me on medium Rohan Ravindra Kadam and on Twitter at **rohankadam25**

Bibliography:-

How to use the Spring Boot Starter for Azure Storage

Thank You, Viewers — Rohan Kadam

Discussion (0)