I created an Azure Storage Account with an Azure Data Lake Storage Gen2. I want to upload a file using the REST API. While using the authorization with Shared Keys works fine, I get problems using an account SAS.
For the path creation I use the Path - Create operation.
# provide Azure Data Lake Storage Gen2 URL as environment variable
$ ADLS_URL="https://xxxxx.blob.core.windows.net/files"
# provide account SAS as environment variable
$ SAS="sv=2017-07-29&ss=bf&..."
# Create a new path in ADLS Gen2
$ curl -vX PUT -H "Content-Length: 112" "$ADLS_URL/example.txt?resource=file&$SAS"
The request returns with 400 An HTTP header that's mandatory for this request is not specified.
and the following error message.
<Error>
<Code>MissingRequiredHeader</Code>
<Message>An HTTP header that's mandatory for this request is not specified. RequestId:870e754b-... Time:2020-07-07T...</Message>
<HeaderName>x-ms-blob-type</HeaderName>
</Error>
It turned out, that the missing header is required for the Creation of a blob in the Blob storage. Since the ADLS Gen2 supports both APIs and both provide a similar operation, it delegates the request to the wrong one.
Is there a way to create a path using PUT operation with a SAS on the ADLS Gen2 API?