locked
set user defined meta data for Azure Blob using powershell RRS feed

  • Question

  • I am trying to set user defined meta data to existing blobs in a container. How can this be done using powershell?

    Thanks!

    Tuesday, January 13, 2015 1:25 AM

Answers

  • Did you check out  Set-AzureStorageBlobContent cmdlet?

    Properties of blob is a hashtable collection which you can initialize and set.

    PS C:\> $Metadata = @{"key" = "value"; "name" = "test"}
    PS C:\> Set-AzureStorageBlobContent -File "ContosoPlanning" -Container "ContosoUploads" -Metadata $Metadata

    Read more at- http://msdn.microsoft.com/en-us/library/dn806379.aspx


    Bhushan | Blog | LinkedIn | Twitter

    Tuesday, January 13, 2015 5:40 AM
  • Thanks for the feedback

    I tried using Set-AzureStorageBlobContent before posting the question. In my case I do not have an argument value for -file.

    My solution was to use IBlobContainer Object on my blob object. Use the Metadata value there followed by a Set metadata method.

    • Marked as answer by SandeepGlobal Friday, January 23, 2015 4:23 AM
    Friday, January 23, 2015 4:23 AM

All replies

  • Did you check out  Set-AzureStorageBlobContent cmdlet?

    Properties of blob is a hashtable collection which you can initialize and set.

    PS C:\> $Metadata = @{"key" = "value"; "name" = "test"}
    PS C:\> Set-AzureStorageBlobContent -File "ContosoPlanning" -Container "ContosoUploads" -Metadata $Metadata

    Read more at- http://msdn.microsoft.com/en-us/library/dn806379.aspx


    Bhushan | Blog | LinkedIn | Twitter

    Tuesday, January 13, 2015 5:40 AM
  • Thanks for the feedback

    I tried using Set-AzureStorageBlobContent before posting the question. In my case I do not have an argument value for -file.

    My solution was to use IBlobContainer Object on my blob object. Use the Metadata value there followed by a Set metadata method.

    • Marked as answer by SandeepGlobal Friday, January 23, 2015 4:23 AM
    Friday, January 23, 2015 4:23 AM
  • Please post the code you used.
    Tuesday, April 18, 2017 9:36 PM