Copy blob using SAS

I have been trying for a couple of days to find an easy way (read:  using tools) to copy blobs in Windows Azure Storage, not by using management keys but using Shared Access Signature (SAS).

Sounds simple enough.  I remembered the AzCopy tool.  I looked around and found a blog post explaining how to use it with SAS, using the DestSAS switch.

I spent hours and I could never make it work.  For starter, AzCopy is designed to copy folders instead of individual files.  But also, I could never get the SAS to work.

After those lost hours, I turned around and look at the Storage REST API.  Turns out you simply need to do an HTTP PUT in order to write a blob into a container.  If the blob doesn’t exist, it creates it, if it exists, it updates it.  Simple?

In PowerShell:

$wc = new-object System.Net.WebClient

$wc.UploadFile(<Blob Address>, "PUT", <Local File Path>)

The Blob Address needs to be the URI containing a SAS.


2 responses

  1. Angel Adrover 2018-10-15 at 02:12

    For me, it works fine, with an SAS, uploading files from my local computer to a Blob Container. After a bit of trial error, It worked with: azCopy.exe /Source: /Dest:”?” and not . Don’t forget the ? character. And can be just obtained with Azure Storage Explorer.

    I used this utility, althougth It doesn’t seem to be much more faster than just dragging and dropping files using Azure Storage Explorer.

  2. Vincent-Philippe Lauzon 2018-10-15 at 13:54

    Yes, that is perfectly normal. Both AzCopy & Storage Explorer are based on the same library (

    The reasons to use AzCopy :

    1. You are in an environment without UI
    2. You want to automate data movement
    3. You want to move data from one cloud source to a cloud destination and do not want to transit the data on your PC / network (related to 1)

Leave a comment