Jun 102014
 June 10, 2014  Posted by at 1:48 pm Azure, PowerShell  Add comments

If you, like me, like Azure and PowerShell you might wonder how to add properties to a blob when uploading. Its simple, the command for upload has a Properties parameter of the type HashTable.
A HashTable is a collection of key value pairs, and for out properties the key is what we want to set and the value what we want to set it to. We do so passing in strings, wrapped in code hugs (or curly braces as others call them). Okay, I am the only one calling them code hugs.


$properties = @{“CacheControl” = “public, max-age=86400”}

So for an upload it would look like something like this (back ticks allows multi line commands- I’ve used it here to make the script more readable, but they are not necessary in this command so remove them and use a one-liner instead if you decide to copy and paste):

$context = New-AzureStorageContext -StorageAccountName $accName -StorageAccountKey $key

$properties = @{“CacheControl” = “public, max-age=86400”}

Set-AzureStorageBlobContent `
-Blob $blobNameWithExtension `
-Container “Name of container” `
-File $file `
-Properties $properties `
-Context $context `


setting blob content properties azure

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



What is 5 + 12 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)