0
votes

My use case is to move data from remote server to azure blob container using SAS as a auth mechanism

Below is my Bash script #!/bin/bash

Upload a blob in an Azure storage container.

unset http_proxy unset https_proxy

storage_account="mystorageacct"

container_name="test"

blob_name="dvc"

upload_file_path="sample.txt"

private_endpoint_address="0.0.0.0"

sas_token="saskey"

blob_store_url="blob.core.windows.net"

request_date=$(TZ=GMT date "+%a, %d %h %Y %H:%M:%S %Z")

storage_service_version="2019-02-02"

x_ms_date_h="x-ms-date:$request_date"

x_ms_version_h="x-ms-version:$storage_service_version"

x_ms_blob_h="x-ms-blob-type: BlockBlob"

curl -v -X PUT -k
-H "$x_ms_date_h"
-H "$x_ms_version_h"
-H "$x_ms_blob_h"
-T "${upload_file_path}"
-H "Host: ${storage_account}.${blob_store_url}"
-H "Content-Length: 0"
-H "Content-Type: text/plain; charset=UTF-8"
https://${private_endpoint_address}/${container_name}/${blob_name}?${sas_token}

when i execute above script it's always getting back with

xml version="1.0" encoding="utf-8"?>InvalidUriThe requested URI does not represent any resource on the server. RequestId:XXXXXX

  • Connection #0 to host one.XXXX.XXX.com left intact
  • Closing connection #0 Time:2020-07-30T16:51:50.0491875Zhttps://mystorageacct.blob.core.windows.net/test/dvc?saskey

Can someone please let me know what went wrong here MSFT documenation don't provide me a clue on URI exceptions

Thanks P

1
hello, I want to confirm that can you solve the issue now?Ivan Yang

1 Answers

0
votes

The issue should come from here:

https://${private_endpoint_address}/${container_name}/${blob_name}?${sas_token}

The private_endpoint_address is "0.0.0.0", so the url of the blob is incorrect.

The correct url of blob should like below:

https://your_storage_account_name.blob.core.windows.net/your_container_name/your_blob_name?sastoken

Please give it a try with the correct url format, and let me know if you still have more issues.