Programmatically upload a file to Azure Blob Storage (ADLS) using C# .Net

Today we will learn on how to programmatically upload a file to Azure Blob Storage (ADLS) using C# .Net
Steps:
  • Create a test file called "sample-blob" and write "Test" inside the file.
  • Open visual studio and create a new console application
  • Install Azure storage blob client library for .Net using Nuget:
    • dotnet add package Azure.Storage.Blobs
  • Create a C# class for uploading the file to blog
    • Import the Azure.Storage.Blobs library
    • Create a reference to the container where you want the file to be uploaded
    • Get a reference to the blob (file name)
    • call the blog.upload(local_file_path) function by the path to the file that you want to upload to Azure blob
    • Now, run the script.
    • Once the script finishes execution, go to Azure blob and check if the file has been uploaded or not
    • Open the file to see if the file contains "test" word in it or not.
                  
    • You are done





No comments:

Post a Comment