Source:
public void sample() throws IOException { BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) .httpClient(HttpClient.createDefault() ) .buildClient(); BlobContainerClient blobContainerClient = null; for (int i = 0; i < 5; i++) { String name = "uxtesting" + UUID.randomUUID(); blobContainerClient = serviceClient.getContainerClient(name); blobContainerClient.create(); System.out.println("Created container: " + name); } System.out.println(); System.out.println("Listing containers in account:"); for (ContainerItem item : serviceClient.listContainers()) { System.out.println(item.getName()); } System.out.println(); for (int i = 0; i < 5; i++) { BlockBlobClient blobClient = blobContainerClient.getBlobClient("testblob-" + i).getBlockBlobClient(); ByteArrayInputStream testdata = new ByteArrayInputStream(("test data" + i).getBytes(StandardCharsets.UTF_8)); blobClient.upload(testdata, testdata.available()); System.out.println("Uploaded blob."); } System.out.println(); System.out.println("Listing/downloading blobs:"); for (BlobItem item : blobContainerClient.listBlobsFlat()) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); blobContainerClient.getBlobClient(item.getName()).download(stream); System.out.println(item.getName() + ": " + new String(stream.toByteArray())); } System.out.println(); for (ContainerItem item : serviceClient.listContainers()) { blobContainerClient = serviceClient.getContainerClient(item.getName()); blobContainerClient.delete(); System.out.println("Deleted container: " + item.getName()); } }

Target:
public void sample() throws IOException { BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) .httpClient(HttpClient.createDefault() ) .buildClient(); BlobContainerClient blobContainerClient = null; for (int i = 0; i < 5; i++) { String name = "uxtesting" + UUID.randomUUID(); blobContainerClient = serviceClient.getBlobContainerClient(name); blobContainerClient.create(); System.out.println("Created container: " + name); } System.out.println(); System.out.println("Listing containers in account:"); for (BlobContainerItem item : serviceClient.listBlobContainers()) { System.out.println(item.getName()); } System.out.println(); for (int i = 0; i < 5; i++) { BlockBlobClient blobClient = blobContainerClient.getBlobClient("testblob-" + i).getBlockBlobClient(); ByteArrayInputStream testdata = new ByteArrayInputStream(("test data" + i).getBytes(StandardCharsets.UTF_8)); blobClient.upload(testdata, testdata.available()); System.out.println("Uploaded blob."); } System.out.println(); System.out.println("Listing/downloading blobs:"); for (BlobItem item : blobContainerClient.listBlobsFlat()) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); blobContainerClient.getBlobClient(item.getName()).download(stream); System.out.println(item.getName() + ": " + new String(stream.toByteArray())); } System.out.println(); for (BlobContainerItem item : serviceClient.listBlobContainers()) { blobContainerClient = serviceClient.getBlobContainerClient(item.getName()); blobContainerClient.delete(); System.out.println("Deleted container: " + item.getName()); } }