How to copy blobs in Azure Storage using PowerShell without override and without confirmation for each file? How to copy blobs in Azure Storage using PowerShell without override and without confirmation for each file? powershell powershell

How to copy blobs in Azure Storage using PowerShell without override and without confirmation for each file?


Please try using the -Force parameter.

From the documentation:

-Force

Indicates that this cmdlet overwrites the destination blob without prompting you for confirmation.

So your command would be:

$blobs | Start-AzureStorageBlobCopy -Context $sourceContext -DestContext $destinationContext -DestContainer $DestinationContainerName -Force


According the command help document Start-AzureStorageBlobCopy ,maybe It has no way to not overwrite the existing files with parameter without asking. Since the backup container size is several TB, excluding the existing files(blob) via PowerShell code maybe not a good choice.

Please have a try to with -confirm: $true it will be asked just once if you select [Yes to All] or [No to All]. As you don’t want to overwrite the existing files, please select the [No to All] option.

$blobs | Start-AzureStorageBlobCopy -Context $sourceContext -DestContext $destinationContext -DestContainer $DestinationContainerName -Confirm:$true

Confirm

By the way -Force it will overwrite all existing files without asking.