0
votes

I want to upload a static html file to the $web folder on an Azure storage account. How do I do this from the Azure CLI?

1

1 Answers

0
votes

I got it working with the following steps (in Bash on WSL):

(1.) run

az storage account show-connection-string -n MY_STORAGE_ACCOUNT_NAME -g MY_RESOURCE_GROUP_NAME --query connectionString -o tsv

to obtain a Storage connection string, which will look something like:

DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=jamesexampleaccountname;AccountKey=ABc1/D1EFGHIJKLMNOPQRSTUVWXYZ/ABCDEFGHIJK/LMNOPQRSTUVWXYZABCDEFGHIJKLMNOPq==

(2.) run

AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=jamesexampleaccountname;AccountKey=ABc1/D1EFGHIJKLMNOPQRSTUVWXYZ/ABCDEFGHIJK/LMNOPQRSTUVWXYZABCDEFGHIJKLMNOPq=="

NOTE: the Storage connection string has to be enclosed in quotes for this to work.

(3.) finally, to upload the file run:

az storage blob upload -c '$web' -f "index.html" -n "index.html"

NOTE: $web must be enclosed in SINGLE quotes for this to work.