I am trying to upload a blob to azure storage account using REST API.
As read in many docs, I am first creating the file:
$headers = @{ 'x-ms-blob-type' = 'BlockBlob' } Invoking PUT operation to the SAS URI (directly copied from Azure portal)
https://mystorage.blob.core.windows.net/pdf/agb_megasim.pdf?sp=rac&st=2021-06-30T09:52:08Z&se=2021-07-31T17:52:08Z&spr=https&sv=2020-02-10&sr=c&sig=uhuEFp%2Bl1MJO%2B8dfsUYkfpegPK9KeYPOPsN08govKGg%3D Next, I am sending (PUT) a byte stream to the url. The SAS url is modified to add comp=range
$headers = @{ "x-ms-version" = "2015-02-21" "x-ms-range" = "bytes=0-86751" "x-ms-date" = "7/5/2021 4:55:47 PM" "x-ms-write" = "update" 'x-ms-blob-type' = 'BlockBlob' } https://mystorage.blob.core.windows.net/pdf/agb_megasim.pdf?**comp=range**&sp=rac&st=2021-06-30T09:52:08Z&se=2021-07-31T17:52:08Z&spr=https&sv=2020-02-10&sr=c&sig=uhuEFp%2Bl1MJO%2B8dfsUYkfpegPK9KeYPOPsN08govKGg%3D <?xml version="1.0" encoding="utf-8"?> <Error> <Code>InvalidQueryParameterValue</Code> <Message>Value for one of the query parameters specified in the request URI is invalid. RequestId:bd905701-d01e-0036-6fbc-71bbbf000000 Time:2021-07-05T16:42:26.9354872Z</Message> </Error> This seems to be the procedure from various documents I tried, but doesnt work for me! I tried using Powershell and postman.
Any idea which parameter is causing the issue?
Also, this is how i intend to pass the file contents: Reading the file
$fileContentBytes = [System.IO.File]::ReadAllBytes($file) Not sure, if encoding is required,
[System.Convert]::ToBase64String($fileContentBytes)