In this comprehensive article, I will walk you through the major methods for uploading files to Azure Blob Storage, from simple drag-and-drop to high-performance command-line tools.
Table of Contents
How To Upload File To Azure Blob Storage
Method 1: Using Azure Portal
Follow the steps below.
1. The first step is to create an Azure storage account and a container in the Azure Portal. Follow the article on How to Create Azure Blob storage to create the Azure storage account and the Blob container.
2. Now, navigate to the newly created container you created above, or use your existing container in the Azure portal.

3. Then, click on the name of the container, and the container page will open. Click on the Upload button there.

4. On the Upload blob window, click on the Browse button, select the file to be uploaded from the local path of your system, and then click on the Upload button.

Now, it will show you a message that the upload of upload.txt is complete.

You can see below that the file has been uploaded successfully to my Azure container.

Method 2: Using C#
Before we start development activities, we need a storage account and must create a container in the Azure Portal.
If you do not have the storage account and container created, refer to my article How to Create Azure Blob Storage to create both.
Note: An Azure storage account and the container to be created in the Azure portal is Must before working on the upload and download files from the Blob storage.
You now have the Azure storage account and container created in the Azure Portal. Now we will create a console application in C# using Visual Studio 2019 for the following functionality.
- Upload a file to Azure blob storage using C#
- Download a file from the Azure blob storage using C#
1. The first step is to create a console application using Visual Studio 2019. To do that, click on File –> New –> Choose Console App (.NET Framework) from the Create a new Project window and click the Next button.

2. Enter the Project name, select the location, and click the Create button to create the console application.

3. The next step is installing the NuGet package to access Azure Storage.
Go to Tools –> NuGet Package Manager –> Manage NuGet Packages for Solution.

4. Search for Azure storage and select the Azure.Storage.Blobs. Select the Project name option, then click the Install button.

Click on the I Accept button on the License Acceptance window.

It will install the NuGet package for you now. Use the below namespaces in your Program.cs file
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;You can see below.

There might be a chance you will get the error. The type or namespace name ‘Azure’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?). To fix this issue, add the two libraries listed below as references to the project.

Let’s create two methods in the Main() method of the Program.cs file i.e AzureFileUpload() and AzureFileDownload()
- AzureFileUpload() – Use to upload files to the Azure blob storage.
- AzureFileDownload() – Use to download the file from the Azure blob storage.
static void Main(string[] args)
{
AzureDemo azureDemo = new AzureDemo();
azureDemo.AzureFileUpload("D:\\Upload.txt", "democontainer");
azureDemo.AzureFileDownload("Upload.txt", "democontainer");
Console.ReadKey();
}
I have created a class named AzureDemo with method definitions.
There are two parameters for the AzureFileUpload() method: The file name to be uploaded and the Container name.
In the AzureFileUpload() and AzureFileDownload () methods, we need to use the Azure storage connection string. So, we need to copy that from the Azure Portal.
To copy that, navigate to the storage account you will use, click Access keys, then copy the connection string as highlighted below, and keep it in a notepad. Later on in the code, you can use it.

Below is the code for the AzureFileUpload().
public void AzureFileUpload(string fileName, string containerName)
{
string myFile,
myFileName,
myConnectionString;
Stream file;
//Copy and paste the connection string from Azure portal
myConnectionString = "DefaultEndpointsProtocol=https;AccountName=sqlvaqrc7kssdx4eus;AccountKey=Coro2SvGOTD+nT3YdaKCrnauz########";
file = new FileStream(fileName, FileMode.Open);
CloudStorageAccount mycloudStorageAccount = CloudStorageAccount.Parse(myConnectionString);
CloudBlobClient blobClient = mycloudStorageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference(containerName);
// Check for the container if it exists or not
if (container.CreateIfNotExists())
{
container.SetPermissionsAsync(new BlobContainerPermissions
{
PublicAccess =
BlobContainerPublicAccessType.Blob
});
}
myFile = Path.GetExtension(fileName);
myFileName = Path.GetFileName(fileName);
CloudBlockBlob myBlockBlob = container.GetBlockBlobReference(myFileName);
myBlockBlob.Properties.ContentType = myFile;
// Upload the file to the blob storage
myBlockBlob.UploadFromStreamAsync(file);
Console.WriteLine("Upload Completed Successfully!!!!");
}
You have copied the Azure storage connection string following the above steps to a notepad. Now is the time to copy and paste it into the line of code below in the AzureFileUpload() method.
//Copy and paste the connection string from the Azure portal
myConnectionString = “Provide the connection string of your storage account”;
FileStream() is used to read the file from the local path of your computer.
file = new FileStream(fileName, FileMode.Open);
The code below creates an instance of the Storage account.
CloudStorageAccount mycloudStorageAccount = CloudStorageAccount.Parse(myConnectionString);
Similarly, the code below creates an instance of the Blob Client.
CloudBlobClient blobClient = mycloudStorageAccount.CreateCloudBlobClient();
This line of code creates an instance of the Blob Container.
CloudBlobContainer container = blobClient.GetContainerReference(containerName);
The code below checks whether an existing container exists; if not, it creates a new container in the storage account with the specified name.
// Check for the container if it exists or not
if (container.CreateIfNotExists())
{
container.SetPermissionsAsync(new BlobContainerPermissions
{
PublicAccess =
BlobContainerPublicAccessType.Blob
});
}If you run the code, you can see it is uploaded successfully to the demo container.

Method 3: Using PowerShell
Sign in to Azure
The first thing is we need to log in to Azure with the below cmdlet
PS C:\WINDOWS\system32> Login-AzureRmAccountOr, you can also use the below PowerShell cmdlet to connect to Azure
PS C:\WINDOWS\system32> Connect-AzAccountThe next step is to get the storage account keys from the Azure portal and assign them to a variable with the below cmdlet
$Keys = "Coro2SvGOTD+nT3YdaKCrnauzWvHMF6BXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=="To get the above key from the Azure portal,
Log in to the Azure portal, navigate to the storage account you will use, click on the Access keys, and then copy the Keys as highlighted below.

Now, use the below PowerShell cmdlet, i.e., the Context, to interact with the Azure storage account with the above AccessKey.
$StorageContext = New-AzureStorageContext -StorageAccountName sqlvaqrc7kssdx4eus -StorageAccountKey $KeysThe below cmdlet is to set the local file path, container name, and Blob along with the Storage context.
Set-AzStorageBlobContent -File "D:\Bijay\Upload9.txt" -Container $containerName -Blob "Upload9.txt" -Context $StorageContextNow, the Complete PowerShell script is as follows.
Login-AzureRmAccount
$Keys = "Coro2SvGOTD+nT3YdaKCrnauzWvHMF6BmuD9PfSKtNJWt6etOMjkwg6KNSQ39zOOQcMpDSjyBKHdALGIg6gZ4Q=="
$StorageContext = New-AzureStorageContext -StorageAccountName sqlvaqrc7kssdx4eus -StorageAccountKey $Keys
$containerName = "democontainer";
Set-AzStorageBlobContent -File "D:\Bijay\Upload9.txt" `
-Container $containerName `
-Blob "Upload9.txt" `
-Context $StorageContext 
It will ask you to enter the Azure credentials. Enter your credentials, and click the sign-in button as shown in the screenshot below.

Then, it will execute successfully and upload the file to the Azure container. Check out the screenshot below for your reference.

To check that, navigate to the container in the Azure portal and see the file uploaded successfully.

Method 4: Using AzCopy
AzCopy is an excellent command-line tool that helps us transfer data to and from Azure storage. That also helps to schedule different categories of Backups in Azure storage. It can also help you copy data to or from Azure Stack. You can find more information about AzCopy now.
- Open the command prompt, navigate to the folder where you have downloaded the AzCopy, and then run the command below to log in.
azcopy login
- Now, as mentioned above, navigate to https://login.microsoftonline.com/common/oauth2/deviceauth, enter the code mentioned on the above screen in the pop-up below, and then click on the Next button.

- Once you log in successfully, you will see “Login succeeded.” Now run the command below to create a container in the respective storage account where we will upload the files.
azcopy make “https://<your azure storage accountname>.blob.core.windows.net/<name of your container>”Example
azcopy make "https://Demoaccount.blob.core.windows.net/test1"Once you execute the above command, it will display a message that says “Successfully created the resource.”
- The next step is to execute the command below to copy a file from your local machine to your Storage account.
azcopy copy <Your file location in your local path> “https://<your storage account name>.core.windows.net/< your container name>/”Example
azcopy copy 'C:\azcopy\Testing\testing.txt' 'https://Demoaccount.blob.core.windows.net/test1'Once you run the command above, it will display the message “Final Job status: Completed” in the command prompt.
- You can execute the command below to copy all the files to your storage account.
azcopy copy "<Your folder location in your local path>" 'https://<your storage account name>.blob.core.windows.net/<container>' --recursiveExample
azcopy copy "C:\azcopy\Testing2\test" "https://Demoaccount.blob.core.windows.net/test1" --recursiveOnce you run the command above, it will display the message “Final Job status: Completed” in the command prompt.
Now, if you log in to the Azure Portal and navigate to the Azure Storage account, you can see that the folder has been created successfully inside the container, and all the files are there.
Method 5: Azure Storage Explorer (Best for Power Users)
For IT professionals who handle cloud data daily, I always recommend downloading Azure Storage Explorer. It is a free, standalone app from Microsoft that runs on Windows, macOS, and Linux. It feels exactly like using “File Explorer” on your PC, but for the cloud.
Why use it?
- Bulk Uploads: It handles hundreds of files much better than a browser.
- Resume Capability: If your internet blinks, it can often resume where it left off.
- Security: You can sign in using your Microsoft Entra ID (Azure AD) credentials or a SAS (Shared Access Signature) token.

Choosing the Right Upload Method
With so many options, how do you choose? I’ve put together this comparison table to help you decide based on your specific business needs.
| Requirement | Recommended Tool | Skill Level |
| One-off small file | Azure Portal | Beginner |
| Managing many folders | Azure Storage Explorer | Intermediate |
| Massive data migration (TB+) | AzCopy | Professional |
| Scheduled nightly scripts | Azure CLI / PowerShell | Professional |
Check out: How to download file from Azure Blob Storage
Final Thoughts:
Uploading files to Azure Blob Storage is a fundamental skill for any modern IT professional or developer. Whether you prefer the visual simplicity of the Azure Portal or the raw power of AzCopy, the key is to understand which tool fits the job.
You may like the following Azure tutorials:
I am Bijay, a Microsoft MVP (10 times) having more than 17 years of experience in the software industry. During my IT career, I got a chance to share my expertise in SharePoint and Microsoft Azure, like Azure VM, Azure Active Directory, Azure PowerShell, etc. I hope you will learn from these Azure tutorials. Read more
