4
votes

Is there a way of using a SAS (shared access signature) to access an Azure storage container from the CLI?

It's clearly possible using an account name and a key, or using a connection string. But I want to use the CLI in a script that should only be able to read from a container.

2

2 Answers

6
votes

The ability to list blobs with sas (via --sas command line parameter) has been around for a while.

The latest CLI (0.10.2) now has a --sas command line option when uploading/downloading blobs as well. So...

azure storage blob upload --sas <sas> -c <connection-string> ...
azure storage blob list --sas <sas> ...
azure storage blob download --sas <sas> ...
0
votes

In newest versions of Azure CLI:

az storage blob upload --connection-string "<your SAS connection string>"
az storage blob list --connection-string "<your SAS connection string>"
az storage blob download --connection-string "<your SAS connection string>"