Every so often you need to copy a bunch of blob data around in the cloud. The Start-CopyAzureStorageBlob PowerShell cmdlet can be useful for kicking off that copying. It returns an object you can use to poll on the status of the copy if you are copying large blobs that take a while.
While using Start-CopyAzureStorageBlob today I got this rather cryptic error message:
Start-CopyAzureStorageBlob : The remote server returned an error: (412) The condition specified using HTTP conditional header(s) is not met.. HTTP Status Code: 412 - HTTP Error Message: The condition specified using HTTP conditional header(s) is not met.
Quite perplexing as of course all the HTTP conditional headers are a layer of abstraction down from the PowerShell cmdlet. Hey, don't look at me, I wasn't the one who created the HTTP headers! 🙂
It turned out I was specifying the -force keyword, a holdover from an abandoned copy I had restarted. After removing the -force keyword to the cmdlet invocation, I got a clearer error message:
Start-CopyAzureStorageBlob : The remote server returned an error: (409) Conflict. HTTP Status Code: 409 - HTTP Error Message: There is currently a pending copy operation.
I got this error because I already have a copy underway to copy the same blob to a different storage account. Apparently you have to wait for the current copy of a blob to finish before you use it as a source for another copy operation. Who knew? I guess I do now! 🙂
Just another puzzling way blobs are different than files in a file system.