If you try to send a >256MB (well, really MiB – 1024-based) payload, the request fails with a 413 error.The default assumed by Storage (at least for this API use).
PutBlob doc page not being explicit about defaults, there’s no longer a need to send the Storage API version explicitly (e.g., -H 'x-ms-version: ', or higher) to allow data sizes in the 64MB to 256MB range. Leaving those options out has the added gain of a fast-fail (before data payload is sent) in the case of a >256MB payload or a bad URI.
It appears that cURL translates to Invoke-WebRequest in PowerShell. I wouldn’t recommend this approach for anything over ~4MiB in size. Note: $URI line removed from screenshot to protect my storage account $headers = -uri $uri -Method Put -Body $file -ContentType "image/png" -Headers $headers If you have a relative small file (that you can load into memory and do with a single PutBlob call) $file = Get-Content. It’s much easier to use SAS tokens for this and append it to the query Generating the derived authorization header (SharedKey) from the storage account key may be bit difficult in this environment. If you have a good case for using Invoke-WebRequest instead a few suggestions: The best approach would be to use the native PowerShell Cmdlets. Signature=$(printf "$string_to_sign" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$decoded_hex_key" -binary | base64 -w0)Īuthorization_header="Authorization: $authorization $storage_account:$signature" # Create the HMAC signature for the Authorization header # Decode the Base64 encoded access key, convert to Hex.ĭecoded_hex_key="$(echo -n $access_key | base64 -d -w0 | xxd -p -c256)" X_ms_version_h="x-ms-version:$storage_service_version"Ĭanonicalized_headers="$" # List the blobs in an Azure storage container.