Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clean a blob before copying to it (Azure release pipeline)

Tags:

azure-devops

My release pipeline uploads to blob storage using Azure File Copy

I want to delete the existing files in the blob before copying over the new files.

The help shows that

cleanTargetBeforeCopy: false

only applies to a VM

(since it is a release pipeline I can't edit the YAML anyway)

The tool tip for Optional Arguments shows

Optional AzCopy.exe arguments that will be applied when uploading to blob like, /NC:10. If no optional arguments are specified here, the following optional arguments will be added by default. /Y, /SetContentType, /Z, /V, /S (only if container name is not $root), /BlobType:page (only if specified storage account is a premium account). If source path is a file, /Pattern will always be added irrespective of whether or not you have specified optional arguments.

like image 586
Kirsten Avatar asked Nov 28 '25 03:11

Kirsten


1 Answers

I want to delete the existing files in the blob before copying over the new files.

If you want to override the blobs during run copy file task, we neeed to add another optional argument at all.

As you mentioned that if we don't add optional Arguments. /Y paramter is added by default.

The blobs will be replaced by the new files by default when run Azure Copy Files task.

If you want to clean the container, you could use the Azure Powershell command to delete the container and recreate the new one before run the Azure copy file task.

like image 128
Tom Sun - MSFT Avatar answered Nov 29 '25 22:11

Tom Sun - MSFT