I have an API that allows users to upload and download files to my Azure Storage containers. With downloading files I have a simple function in my HTML script that uses user input information (SAS tokens, etc.) to create a URL where the user can download their file.
With file uploads, however, I have a whole separate Azure Function creating Blob Clients and Container Clients to upload data to Azure Storage containers. I was wondering if there was a simpler way to upload files to Azure Storage containers using a URL, with minimal code similar to how Azure Storage container file downloads work.
If I understand correctly, you are asking whether it is possible to create a container and / or upload a blob using http calls instead of the SDK. If that is the case you can leverage the REST Api.
For the examples below, I used a SAS token to authenticate,
To create a container you can use a PUT like this:
PUT https://myaccount.blob.core.windows.net/mycontainer?restype=container&sv=2021-10-04&ss=btqf&srt=sco&st=2023-05-12T06%3A48%3A03Z&se=2023-05-13T06%3A48%3A03Z&sp=rwl&sig=I8EPwY4xhBWSbQKbPbasyXWnjwD%2BJTg8jHExZi9%2BU0w%3D
To upload a blob to the container you can use a PUT as well
PUT https://myaccount.blob.core.windows.net/mycontainer/myblob.txt?sv=2021-10-04&ss=btqf&srt=sco&st=2023-05-12T06%3A48%3A03Z&se=2023-05-13T06%3A48%3A03Z&sp=rwl&sig=I8EPwY4xhBWSbQKbPbasyXWnjwD%2BJTg8jHExZi9%2BU0w%3D
x-ms-blob-type: BlockBlob
HELLO WORLD
(Note: I used an .http file in visual studio to create the examples, see this blog post. So the code above can be put in a file with .http extension to test it)