Rename files located on Azure storage container RRS feed

  • Question

  • Hello Experts,

    Could you please advise me the PowerShell commend I can use to rename files that are located on Azure storage container? 'Rename-Item' does not seem to fit in this case as the files are not located locally. Thanks.

    Wednesday, January 25, 2017 2:10 AM


  • This works by copying the file to a new name and removing the old file.

    You can use this code (replace values between <>) and first login using Login-AzureRmAccount

    $Context = New-AzureStorageContext -StorageAccountName "<container name>" -StorageAccountKey "<key>"
    Start-AzureStorageBlobCopy -SrcContainer "<container name>" -DestContainer "<container name>" -SrcBlob "<current blob name>" -DestBlob "<new blob name>" -Context $Context -DestContext $Context
    Remove-AzureStorageBlob -Container "<container name>" -Context $Context -Blob "<old blob name>"

    Microsoft Application Virtualization 5.1 eBook | Twitter | Blog | App-V Deployment Whitepaper

    If you see a post that helped you please click Vote As Helpful and if it answered your question please click Mark As Answer. This forum post is based upon my personal experience and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    • Marked as answer by jrprakash Wednesday, January 25, 2017 11:51 AM
    Wednesday, January 25, 2017 8:13 AM