How to read content of azure blob with url for each static file uploaded

Posted By : Chetan Hallan | 30-Sep-2015

In this blog we will learn about how we can read content from our azure blob. If you are not familiar with azure blob then you can refer to my previous posts How to create an azure blob from grails application and If you don't know how to upload any static file in azure storage then first go through this link to get the brief idea about how azure works How to upload a static file in azure blob from grails application

To read all the content from your azure blob you can use the following code.


  1. You have created an azure blob successfully.
  2. Uploaded some static files in the blob storage.
public void read(){
			// Retrieve storage account from connection-string.
			CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
			System.out.println("connection established");
			// Create the blob client.
			CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
			System.out.println("client created"+blobClient.getStorageUri());
			// Retrieve reference to a previously created container.
			CloudBlobContainer container = blobClient.getContainerReference("catalog");
			System.out.println("referrence fetch"+container.getName());
			// Loop over blobs within the container and output the URI to each of them.
			for (ListBlobItem blobItem : container.listBlobs()) {
		catch (Exception e)
			// Output the stack trace.

With the help of the above code you will get a list of all the files of ur all static files uploaded in the azure blob with their url's. 

For any further Queries and Questions you can contact me via comments. Feel free to comment and ask.



About Author

Author Image
Chetan Hallan

Chetan is a bright Full Stack Java Developer, he has expertise in JAVA, Spring, Hibernate, AngularJS and MySQL.

Request for Proposal

Name is required

Comment is required

Sending message..