Azure Blob download(GET) causes failed PUT request Azure Blob download(GET) causes failed PUT request azure azure

Azure Blob download(GET) causes failed PUT request


As mentioned in the release notes about Microsoft Azure Storage Libraries for .NET for version 8.0.0:

CreateIfNotExists methods will now only do one REST call instead of two.

Here is my test, you could refer to it for a better understanding of this change:

Prior to version 8.0.0, CreateIfNotExists would check the existence of the target, then create the resource if not exists as follows:

While after this version 8.0.0, CreateIfNotExists would invoke the create method directly and wrap this operation with try-catch to capture the exception.

In summary, this issue dues to the changes of the Microsoft Azure Storage Libraries for .NET under the specific version. You could invoke CloudBlobContainer.Exist(), then call CloudBlobContainer.Create() instead of CloudBlobContainer.CreateIfNotExists. But at this point, you need to wrap CloudBlobContainer.Create() with try-catch to capture exceptions (e.g. someone has created the resource with the same name,etc.) by yourself.

Additionally, you could leverage ILSpy or ReSharper to retrieve more detailed implementation about CloudBlobContainer.CreateIfNotExists.


The PUT request is triggered by container.CreateIfNotExists(), which should fail as expected when your container already exists. The whole code path works correctly and I don't think you need to worry anything.

The mechanism of container.CreateIfNotExists() is that Azure Storage Client Library will send a Put Container request to server, and swallow the error if it's 409 (Conflict) since it indicates the container already exists.