Step by Step approach to Upload a text file to Azure Blob Storage using AzCopy Command-Line Utility

Rajnilari2015
Posted by in Azure category on for Beginner level | Points: 250 | Views : 823 red flag

Azure Blob storage is a service for storing large amounts of unstructured data.AzCopy is a Windows command-line utility designed for copying data to and from Microsoft Azure storage (e.g.Blob, File, and Table) using commands. In this article we will look into how to upload a text file to Azure Blob Storage using AzCopy Command-Line Utility in a step by step manner.

Introduction

Azure Blob storage is a service for storing large amounts of unstructured data.AzCopy is a Windows command-line utility designed for copying data to and from Microsoft Azure storage (e.g.Blob, File, and Table) using commands. In this article we will look into how to upload a text file to Azure Blob Storage using AzCopy Command-Line Utility in a step by step manner.

Step by step approach

Step 1: Installation of AzCopy

As a first step we need to install the AzCopy tool as described under.

Download latest version of AzCopy. Click the MicrosoftAzureStorageTools.msi file

Click Next

Click Next

Click Next

Click Install.

Once the installation is over, we will get

Click Finish.

The "AzCopy.exe" file is installed to "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy"

Open command prompt in Admin mode and point to AzCopy installation directory on the computer

C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy>

Step 2: Create a Blob Container in the Azure Portal

Open the Azure portal(https://portal.azure.com), and then choose Storage Account

As a first step we need to create Storage Account

Refresh to list the Storage account(e.g. testrnablob)

Click on testrnablob and the below opens

Now we need to create a blob container so click on the "+" button

Click Create button.

But at present no blob is added as revealed below

Step 3: Get the Access Keys

We need to get the access keys as shown under

Step 4: Create a text file

Now let us create a text file say (BlobInputByRNA_3_6_2017.txt) under D:\BlobSource whose content is as under

Step 5: Upload the text file from local disk to Azure blob storage using the AzCopy Command-Line Utility

Now issue the below command from the command prompt.

AzCopy /Source:D:\BlobSource /Dest:<AZURE BLOB CONTAINER URL> /DestKey:<ACCESS KEY> /Pattern:"*.txt" /destType:blob

The general syntax is

AzCopy /Source:<SOURCE FOLDER> /Dest:<AZURE BLOB CONTAINER URL> /DestKey:<ACCESS KEY> /Pattern:"*.txt" /destType:blob

Step 6: Check the Blob Container

If we check the blob container, we will find

So our file has been uploaded successfully

If we want to upload multiple files into the blob storage like [ A text file, a video file, an image file, a csv and an excel file]

we have to issue the below command

C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy>AzCopy /Source:D:\BlobSource
/Dest:https://testrnablob.blob.core.windows.net/rna-blob-container /DestKey:<ACCESS KEY> /destType:blob

If we check the blob container, we will find

Conclusion

In this article we saw how to upload unstructured files from local disk to Azure Blob Storage (for both single and multiples) using AzCopy utility in a step by step manner. Hope this will be helpful. Thanks for reading.

Page copy protected against web site content infringement by Copyscape

About the Author

Rajnilari2015
Full Name: Niladri Biswas (RNA Team)
Member Level: Platinum
Member Status: Member,Microsoft_MVP,MVP
Member Since: 3/17/2015 2:41:06 AM
Country: India
-- Thanks & Regards, RNA Team


Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)