insert a file in azure container

If you are just looking for .net core code to upload blobs and list containers, just try this .net core console app below:

using Azure.Storage.Blobs;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

namespace blobUpload
    class Program
        static void Main(string[] args)
            string localFilePath = "<path of file to upload>";
            string containerName = "<container name>";
            string storageConnStr = "<storage account connection string>";

            BlobServiceClient blobServiceClient = new BlobServiceClient(storageConnStr);

            listContainerBlobs(blobServiceClient, containerName);

            Console.WriteLine("====upload files to a Container====");
            uploadFiles(blobServiceClient, localFilePath, containerName);


        public static void uploadFiles(BlobServiceClient blobServiceClient,String filePath,string containerName) {
            var container = blobServiceClient.GetBlobContainerClient(containerName);
            var blobClient = container.GetBlobClient("");

        public static void listContainers(BlobServiceClient blobServiceClient) {
            var containerEmulator = blobServiceClient.GetBlobContainers().GetEnumerator();
            while (containerEmulator.MoveNext()) {

        public static void listContainerBlobs(BlobServiceClient blobServiceClient,string containerName)
            var container = blobServiceClient.GetBlobContainerClient(containerName);
            var blobEmulator = container.GetBlobs().GetEnumerator();
            while (blobEmulator.MoveNext())




Result : enter image description here the uploaded file: enter image description here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top