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.
2
Answers
AFAIK, you need the container and blob clients to upload a file. Alternatively, you can use below commands in azure PowerShell Function with which you do not need clients.
You can integrate below commands into Azure PowerShell Function which do not uses clients:
File Uploaded as below:
And if you want to use . Net, Python SDKs or java you need to have the clients of block service or some azure storage packages.
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:
To upload a blob to the container you can use a PUT as well
(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)