15

I'm using VSTS to deploy an Angular app to blob storage making use of the new static website feature. For this I'm using the Azure File Copy task. Since Angular will create new filenames for the different bundles on every build I can't just overwrite the old files, so eventually there will be a lot of old & unsused files in that $web container.

Unfortunately I haven't found a suitable task to do that.

How can I delete or clear out this container in VSTS using the release pipeline before redeploying?

Bryant
  • 8,660
  • 1
  • 33
  • 53
Thomas
  • 4,030
  • 4
  • 40
  • 79
  • any update on my answer? Is my answer is helpful please accept/upvote it? so that it can help other community members – Jayendran Sep 04 '18 at 14:18
  • sorry for the delay, I had this project on hold for a while - works perfectly! – Thomas Sep 11 '18 at 14:22

1 Answers1

22

Azure File Copy is internally using AzCopy so it's is not possible to delete/clean up the container using Azure File Copy

You can use Azure CLI task to invoke the az cmdlets to clean up your container before running the Azure File Copy task

az storage blob delete-batch --account-name <storage_account_name> --source <container_name>

enter image description here

Jayendran
  • 9,638
  • 8
  • 60
  • 103
  • Would this then presumably introduce some application downtime as the storage account is left without files in between the two operations? – Mushkov May 17 '19 at 22:49
  • 1
    @Mushkov Normally you would put an Azure CDN in front of the Blob which caches the content and serves it to the client. The CDN will then continue serving the "old" content while you delete and deploy to the storage - and then you would "purge" the CDN to refresh the cache - hence no downtime... – martinrene Aug 06 '20 at 10:36